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 |