From: Tony M. <mul...@gm...> - 2005-11-01 01:40:58
|
Hello, I'm new to PythonCard and to wxPython and I'm still working on getting a clear understanding of how they work together. I would like to create windows in my application which do not have the header bar, or in some cases with no frame at all (for example for a splash screen widget). I see in the PythonCard Framework Overview that various window styles are not supported. Is there a workaround for this?=20 Also, does this lack of scrolling refer only to Backgrounds, or is scrolling not supported in any widgets? Thanks very much, Tony Mullen |
From: Alex T. <al...@tw...> - 2005-11-01 12:45:52
|
Tony Mullen wrote: >Hello, > >I'm new to PythonCard and to wxPython and I'm still working on getting >a clear understanding of how they work together. I would like to >create windows in my application which do not have the header bar, or >in some cases with no frame at all (for example for a splash screen >widget). I see in the PythonCard Framework Overview that various >window styles are not supported. Is there a workaround for this? > > Not yet - but I'm looking into it now.:-) I wanted this about six months back - but not strongly enough to pursue it then; but I have some ideas on how it might be tackled. I will say more later today. >Also, does this lack of scrolling refer only to Backgrounds, or is >scrolling not supported in any widgets? > > It's supported in TextFields, ListFields, etc. and other text widgets. I don't think there's any support for wx's ScrolledWindows - i.e. what you'd want for a general scrolling window. You can, of course, create your own wx.ScrolledWindow - but it means you have to use (and learn) wx's way of getting and handling events, drawing items, etc. This can still be worthwhile - you get the benefit of PCard's ease of use for most of your menus, widgets, etc. - and only revert to using the more primitive wx calls directly when needed. I've done my own scrolling within a BitMapCanvas when I didn't need standard scroll bars - you may be able to do that and simply add scroll bars with wx. Let us know more about what you want to do with the scrolling and we may be able to suggest either workarounds, -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.12.6/152 - Release Date: 31/10/2005 |
From: Alex T. <al...@tw...> - 2005-11-01 20:44:01
|
Alex Tweedly wrote: > Tony Mullen wrote: > >> Hello, >> >> I'm new to PythonCard and to wxPython and I'm still working on getting >> a clear understanding of how they work together. I would like to >> create windows in my application which do not have the header bar, or >> in some cases with no frame at all (for example for a splash screen >> widget). I see in the PythonCard Framework Overview that various >> window styles are not supported. Is there a workaround for this? >> > Not yet - but I'm looking into it now.:-) I wanted this about six > months back - but not strongly enough to pursue it then; but I have > some ideas on how it might be tackled. > > I will say more later today. > I'm proposing that we implement this enhancement in two phases, as below. If no-one brings up any problems or objections over the next few days, I'll put this into CVS. It is (of course) fully backward compatible. Overview: A resource file contains a "style" for the background / window. This defaults to [] (and is usually omitted in that case), or it can currently take the value ["resizeable"] to indicate th window should be resizeable. All other style factors are fixed. We will extend this to also allow this to be a list of strings which are wxWindow style constants - e.g. 'style':['wx.SYSTEM_MENU', 'wx.CAPTION', 'wx.CLOSE_BOX'], Phase 1. (you can do this in the short term, even before any CVS change). You'll need to edit in any style changes to the rsrc file by hand. I wouldn't be surprised if these are lost when the rsrc file is edited in the resourceEditor - so keep a copy if the values you need. Change your local copy of PythonCard/model.py as follows (be *sure* to keep a safe copy) Around line 640 (for latest CVS copy, I think around line number 614 for 0.8.1), you'll find > # KEA 2004-01-18 > # have to explicitly declare the close box in wxPython 2.5 > style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | > wx.CLOSE_BOX > if aBgRsrc.style == ['resizeable']: > style = wx.DEFAULT_FRAME_STYLE change that to > # KEA 2004-01-18 > # have to explicitly declare the close box in wxPython 2.5 > if aBgRsrc.style == []: > style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | > wx.CLOSE_BOX > elif aBgRsrc.style == ['resizeable']: > style = wx.DEFAULT_FRAME_STYLE > else: > style = 0 > for i in aBgRsrc.style: > style |= eval(i) (the long term fix will put this in a try:except clause - but you can get by without that for a few days ...) Phase 2. a. Add the try: except protection around the eval() statement b. Extend the resourceEditor to support the definition of window styles. (this isn't hard - I've got a basic version working, but will need more testing ...) -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.12.6/152 - Release Date: 31/10/2005 |