[wxPython] Getting available (screen) space

The Windows API has a call to get the 'work area', the area not covered by
the task bar. From C++, you can get it from a call such as the following:
RECT rWorkArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rWorkArea, 0);

However, I'm not sure if this API has been wrapped by wxWindows. You may
need to dig to look for it.

-Ron Clarke

···

-----Original Message-----
From: Nikolai Kirsebom [mailto:nikolai@micon.no]
Sent: Thursday, April 19, 2001 2:36 PM
To: wxPython List (E-mail)
Subject: [wxPython] Getting available (screen) space

By using the System Metrics information it is possible to get the size of
the display - however how do I compensate for the size the taskbar occupies
(Window) ? I was thinking of creating a frame and maximize it, read it's
size and use this. However is there a more elegant way ?

Thanks for any help.
Nikolai
  
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

The Windows API has a call to get the 'work area', the area not covered by
the task bar. From C++, you can get it from a call such as the following:
RECT rWorkArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rWorkArea, 0);

However, I'm not sure if this API has been wrapped by wxWindows. You may
need to dig to look for it.

It hasn't, but you can get the size of a maximized window like this:

try:
    import win32api, win32con
except ImportError:
    screenWidth = wxSystemSettings_GetSystemMetric(wxSYS_SCREEN_X)
    screenHeight = wxSystemSettings_GetSystemMetric(wxSYS_SCREEN_Y)
else:
    screenWidth = win32api.GetSystemMetrics(win32con.SM_CXMAXIMIZED)
    screenHeight = win32api.GetSystemMetrics(win32con.SM_CYMAXIMIZED)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Hello.

I'm using asynchronous sockets in a multithreaded program
(much of the code for which was posted here a while back)
to handle my network connections. So far, I've only been tossing
back and forth simple Python objects (as strings), and all is good.

But now I want to begin transferring binary files as well.
Things are getting a bit cloudy. How I've handled the
received network events so far is to split them into a package containing
a header and content. On receiving the event, the app parses the header
and then deals appropriately with the content. It's pretty much a one shot deal.

Sending longer files seems problematic for several reasons (all, of course,
relating to my ignorance).

1. The async thread I'm using right now works for receiving events. I'm assuming
that for *sending* several events concurrently, I'll either need to use a similar implementation
or additional threads using new ports (i.e., 1 port for my longer file transfers, a different
port for instant messages, different threads for each...)?

2. Assuming the recipient doesn't want to receive the longer file... I need a way to
implement error handling (i.e., if the file size is too large, or for security reasons)- basically, the sender needs
to be able to 'fire a blank' to alert the recipient, the recipient needs to reply, yadda yadda
like FTP. If I am sending the event from one class instance and the "OK" is being picked up by another
thread instance, how do I then go ahead with the filetransfer?

I.E., With wxEvents, I'm able to send events *back to* a parent thread/window, but so
far I've had no luck forwarding incoming events from Main() to child windows that have
been instantiated and displayed using Show(true).. hmm.

3) this is more a python question, but I am assuming that in transferring files, I am going to
have to do something such as:
a) open file
b) readlines to python variable
c) send python variable w/filename
d) catch it and handle it appropriately.
Does this sound on target, or am I completely missing something here?

I need to get oriented here, because I'm definitely whirling.
just about any suggestion should prove useful at this point.

thanks. :slight_smile:

Stephen