I looked around a lot on the internet and couldn't find out how to do
this, how do I get the sizer (in rows and columns) of the view? 6 7405
On 2007-02-26, jeff <je****************@gmail.comwrote:
I looked around a lot on the internet and couldn't find out how to do
this, how do I get the sizer (in rows and columns) of the view?
You use the TIOCGWINSZ ioctl() call on the tty device in question.
import termios, fcntl, struct, sys
s = struct.pack("HHHH", 0, 0, 0, 0)
fd_stdout = sys.stdout.fileno()
x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s)
print '(rows, cols, x pixels, y pixels) =',
print struct.unpack("HHHH", x)
--
Grant Edwards gr****@visi.com
On 2007-02-26, Grant Edwards <gr****@visi.comwrote:
On 2007-02-26, jeff <je****************@gmail.comwrote:
>I looked around a lot on the internet and couldn't find out how to do this, how do I get the sizer (in rows and columns) of the view?
You use the TIOCGWINSZ ioctl() call on the tty device in question.
import termios, fcntl, struct, sys
s = struct.pack("HHHH", 0, 0, 0, 0)
fd_stdout = sys.stdout.fileno()
x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s)
print '(rows, cols, x pixels, y pixels) =',
print struct.unpack("HHHH", x)
You may also want to handle the WINCH signal so that you know
when the window size has been changed.
--
I don't really understand any of that; can you right me a function
that'll return the size as a tuple?
jeff wrote:
I don't really understand any of that; can you right me a function
that'll return the size as a tuple?
Did you even *try* his code? I ran this:
import termios, fcntl, struct, sys
s = struct.pack("HHHH", 0, 0, 0, 0)
fd_stdout = sys.stdout.fileno()
x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s)
print '(rows, cols, x pixels, y pixels) =',
print struct.unpack("HHHH", x)
And got this result:
(36, 96, 0, 0)
Looks like a tuple to me. return 'return' instead of 'print' the result.
We don't mind helping, but it's nice to know that the user has made some
attempt to understand what is going on before asking for free work to be
done.
j
--
Joshua Kugler
Lead System Admin -- Senior Programmer http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ Â*ID 0xDB26D7CE
--
Posted via a free Usenet account from http://www.teranews.com
On 2007-02-27, jeff <je****************@gmail.comwrote:
I don't really understand any of that; can you right me a function
that'll return the size as a tuple?
What do you think I posted?
--
Grant Edwards grante Yow! I selected E5... but
at I didn't hear "Sam the Sham
visi.com and the Pharoahs"!
On Feb 26, 8:01 pm, Grant Edwards <gra...@visi.comwrote:
On 2007-02-27, jeff <jeffrey.ayleswo...@gmail.comwrote:
I don't really understand any of that; can you right me a function
that'll return the size as a tuple?
What do you think I posted?
--
Grant Edwards grante Yow! I selected E5... but
at I didn't hear "Sam the Sham
visi.com and the Pharoahs"!
nevermind, I figured it outr, it just looked confusing This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: middletree |
last post by:
How do I request the actual page name that I'm on? This is going to go into
an include file, and depending on which page I'm on, I'd like to do
different things. I'm looking for "pagename.asp"
|
by: LRW |
last post by:
I manage our mySQL database through putty (SSH terminal client).
And whenever I do a select * from the table that contains ENCODEd
passwords, the funky characters do funky things with the display....
|
by: dynfax |
last post by:
When I use Access 97 with Terminal Services, and the terminal window is
minimized, the popup form displays - and when i reset the focus to the
terminal window the popup form displays.
In...
|
by: velle |
last post by:
My headache is growing while playing arround with unicode in Python,
please help this novice. I have chosen to divide my problem into a few
questions.
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
...
|
by: Joel Hedlund |
last post by:
Hi all!
I use python for writing terminal applications and I have been bothered
by how hard it seems to be to determine the terminal size. What is the
best way of doing this?
At the end I've...
| |
by: Captain Dondo |
last post by:
I'm working on a terminal emulator for an embedded system.
The key requirements are small size, code clarity, maintainability, and
portability. We have machines that regularly see a service life...
|
by: =?gb2312?B?yMvR1MLkyNXKx8zs0cSjrM37vKvM7NHEsru8+7z |
last post by:
Who could explain the follow issue ?
¦¤
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'gbk' codec can't encode character u'\x80' in
position 0: il...
|
by: rustyc |
last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-)
As I said over there:
... for a little side project at home, I'm writing a ham radio web site in...
|
by: David |
last post by:
Hi list.
I've never used unicode in a Python script before, but I need to now.
I'm not sure where to start. I'm hoping that a kind soul can help me
out here.
My current (almost non-existant)...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |