|
From: John H. <ec...@ya...> - 2011-04-01 14:53:26
Attachments:
Wing IDE Default Project wxMDIParentFrame.jpg
|
I am happy to report that I've succeeded in Pythoncardize
the wx.SashLayoutWindow control of wxPython
using similar technique to the MDI support I reported previously. Not sure if
the screen capture attachment to this email will get stripped or not. If you
don't see the screen shot, shout and I'll try to upload that somewhere.
########## mod to model.py #######################
class Background(BackgroundBase, wx.Frame):
def __init__(self, aParent, aBgRsrc, init=None):
return BackgroundBase.__init__(self, aParent, aBgRsrc,
frameclass=wx.Frame, init=init)
class MDIChildBackground(BackgroundBase, wx.MDIChildFrame):
def __init__(self, aParent, aBgRsrc, init=None):
return BackgroundBase.__init__(self, aParent, aBgRsrc,
frameclass=wx.MDIChildFrame, init=init)
class MDIParentBackground(BackgroundBase, wx.MDIParentFrame):
def __init__(self, aParent, aBgRsrc, init=None):
return BackgroundBase.__init__(self, aParent, aBgRsrc,
frameclass=wx.MDIParentFrame, init=init)
class SashWindow(BackgroundBase, wx.SashLayoutWindow):
def __init__(self, aParent, aBgRsrc, init=None):
rsrc = resource.Resource(aBgRsrc).application.backgrounds[0]
return BackgroundBase.__init__(self, aParent, rsrc,
frameclass=wx.SashLayoutWindow, init=init)
# Dummy routine
def SetMenuBar(self, child):
return
# Dummy routine
def GetStatusBar(self):
return
########## end of mod to model.py #######################--
John Henry
----- Original Message ----
> From: John Henry <ec...@ya...>
> To: pyt...@li...
> Sent: Wed, March 9, 2011 10:08:39 AM
> Subject: Added MDI support to Pythoncard (was MDI - childwindows within a
>window)
>
> I am happy to let you know that I succeeded in adding MDI support to Pythoncard
>
> with only a few lines of modifications to the Background class in model.py
>
> I made the Background class into a BackgroundBase class, and have the
>Background
>
> class subclass from the BackgroundBase class.
>
> Then I added a MDIParentBackground and MDIChildBackground which simply force
> Background to subclass from wxMDIParentFrame and wxMDIChildFrame respectively,
>
> instead of the wx.Frame class. Once I've done that, wxPython does the rest
>of
>
> the work.
>
> ################ mod to model.py ######################
>
> from wxPython.wx import wxMDIParentFrame, wxMDIChildFrame
>
> # Used to say:
> # class BackgroundBase(Scriptable, wx.Frame, event.EventSource):
> class BackgroundBase(Scriptable, event.EventSource):
> """
> A window that contains Widgets.
> """
> def __init__(self, aParent, aBgRsrc, frameclass=wx.Frame):
> ...<original code>...
> #Changed original code from invoking wx.Frame here to a method passed down
> # First, call the base class' __init__ method to create the frame
> frameclass.__init__(self, aParent,
> self.id,
> #self.name,
> aBgRsrc.title,
> position,
> aBgRsrc.size,
> style | wx.NO_FULL_REPAINT_ON_RESIZE,
> aBgRsrc.name)
> ...<rest of original code>...
>
>
> class Background(BackgroundBase, wx.Frame):
> def __init__(self, aParent, aBgRsrc):
> return BackgroundBase.__init__(self, aParent, aBgRsrc,
> frameclass=wx.Frame)
>
> class MDIParentBackground(BackgroundBase, wxMDIParentFrame):
> def __init__(self, aParent, aBgRsrc):
> return BackgroundBase.__init__(self, aParent, aBgRsrc,
> frameclass=wxMDIParentFrame)
>
> class MDIChildBackground(BackgroundBase, wxMDIChildFrame):
> def __init__(self, aParent, aBgRsrc):
> return BackgroundBase.__init__(self, aParent, aBgRsrc,
> frameclass=wxMDIChildFrame)
>
> ############## end of mod to model.py #########################
>
> To use these two new classes, the code is remarkably unremarkable. The parent
>
> code:
>
> ############# Parent ######################
> #!/usr/bin/python
>
> """
> __version__ = "$Revision: 1.5 $"
> __date__ = "$Date: 2004/04/30 16:26:12 $"
> """
>
> from PythonCard import model
>
> MDI_rsrc=\
> {'application':{'type':'Application',
> 'name':'Template',
> 'backgrounds': [
> {'type':'Background',
> 'name':'bgTemplate',
> 'title':'Testing MDI Controls',
> 'size':(400, 300),
> 'style':['resizeable'],
>
> 'menubar': {'type':'MenuBar',
> 'menus': [
> {'type':'Menu',
> 'name':'menuFile',
> 'label':'&File',
> 'items': [
> {'type':'MenuItem',
> 'name':'menuFileExit',
> 'label':'E&xit',
> 'command':'exit',
> },
> ]
> },
> {'type':'Menu',
> 'name':'menuOptions',
> 'label':'Options',
> 'items': [
> {'type':'MenuItem',
> 'name':'menuOptionsOpenNew',
> 'label':'Open New\tAlt+N',
> 'command':'openNew',
> },
> ]
> },
> ]
> },
> 'components': [
>
> ] # end components
> } # end background
> ] # end backgrounds
> } }
>
> MyCW_rsrc=\
> {'application':{'type':'Application',
> 'name':'Template',
> 'backgrounds': [
> {'type':'Background',
> 'name':'bgTemplate',
> 'title':'Standard Template with File->Exit menu',
> 'size':(698, 517),
> 'style':['resizeable'],
>
> 'menubar': {'type':'MenuBar',
> 'menus': [
> {'type':'Menu',
> 'name':'menuFile',
> 'label':'&File',
> 'items': [
> {'type':'MenuItem',
> 'name':'menuFileExit',
> 'label':'E&xit',
> 'command':'exit',
> },
> ]
> },
> {'type':'Menu',
> 'name':'menuOptions',
> 'label':'Options',
> 'items': [
> {'type':'MenuItem',
> 'name':'menuOptionsOpenNew',
> 'label':'Open New\tAlt+N',
> 'command':'openNew',
> },
> ]
> },
> ]
> },
> 'components': [
>
> {'type':'TextArea',
> 'name':'TextArea1',
> 'position':(20, 20),
> 'size':(651, 333),
> },
>
> {'type':'Button',
> 'name':'Button1',
> 'position':(559, 376),
> 'label':'Button1',
> },
>
> ] # end components
> } # end background
> ] # end backgrounds
> } }
>
> class MyBackground(model.MDIParentBackground):
>
> def on_initialize(self, event):
> # if you have any initialization
> # including sizer setup, do it here
> #MDI.on_initialize(self, event)
> pass
> def on_openNew_command ( self, event ):
> # Create a child window
> child = model.childWindow(self, MyCW, rsrc=MyCW_rsrc)
>
> if __name__ == '__main__':
> app = model.Application(MyBackground, None, MDI_rsrc)
> app.MainLoop()
> ############# End of Parent ######################
>
> ############# Child ######################
> class MyCW(model.MDIChildBackground):
>
> def on_initialize(self, event):
> self.parent = self.getParent()
> self.components.TextArea1.text='I am only a child.'
> def on_openNew_command ( self, event ):
> return self.parent.on_openNew_command ( event )
> ############# End of Child ######################
>
> That's it!!!
>
> Now I have to play around with resizer to see how that would work here.
>
> --
> John Henry
> |
|
From: Mark C. <ma...@ma...> - 2011-04-01 16:13:30
|
Hi John.
Awesome! Good to know someone is still developing PythonCard! PythonCard
is really a super project, for infrequent programmers like myself looking
for a Visual Basic-like development experience on Python, PythonCard does
the job.
I don't suppose you could shepherd through a new release? The current
release is several years old IIRC, and the installer has issues (either with
Vista and/or latest Python, can't recall). Most people who research
PythonCard these days just assume it's a dead project.
Mark
On Fri, Apr 1, 2011 at 10:53 AM, John Henry <ec...@ya...> wrote:
> I am happy to report that I've succeeded in Pythoncardize
> the wx.SashLayoutWindow control of wxPython
> using similar technique to the MDI support I reported previously. Not
> sure if
> the screen capture attachment to this email will get stripped or not. If
> you
> don't see the screen shot, shout and I'll try to upload that somewhere.
>
> ########## mod to model.py #######################
> class Background(BackgroundBase, wx.Frame):
> def __init__(self, aParent, aBgRsrc, init=None):
> return BackgroundBase.__init__(self, aParent, aBgRsrc,
> frameclass=wx.Frame, init=init)
>
> class MDIChildBackground(BackgroundBase, wx.MDIChildFrame):
> def __init__(self, aParent, aBgRsrc, init=None):
> return BackgroundBase.__init__(self, aParent, aBgRsrc,
> frameclass=wx.MDIChildFrame, init=init)
>
> class MDIParentBackground(BackgroundBase, wx.MDIParentFrame):
> def __init__(self, aParent, aBgRsrc, init=None):
> return BackgroundBase.__init__(self, aParent, aBgRsrc,
> frameclass=wx.MDIParentFrame, init=init)
>
> class SashWindow(BackgroundBase, wx.SashLayoutWindow):
> def __init__(self, aParent, aBgRsrc, init=None):
> rsrc = resource.Resource(aBgRsrc).application.backgrounds[0]
> return BackgroundBase.__init__(self, aParent, rsrc,
> frameclass=wx.SashLayoutWindow, init=init)
> # Dummy routine
> def SetMenuBar(self, child):
> return
> # Dummy routine
> def GetStatusBar(self):
> return
> ########## end of mod to model.py #######################--
> John Henry
>
>
>
> ----- Original Message ----
> > From: John Henry <ec...@ya...>
> > To: pyt...@li...
> > Sent: Wed, March 9, 2011 10:08:39 AM
> > Subject: Added MDI support to Pythoncard (was MDI - childwindows within a
> >window)
> >
> > I am happy to let you know that I succeeded in adding MDI support to
> Pythoncard
> >
> > with only a few lines of modifications to the Background class in
> model.py
> >
> > I made the Background class into a BackgroundBase class, and have the
> >Background
> >
> > class subclass from the BackgroundBase class.
> >
> > Then I added a MDIParentBackground and MDIChildBackground which simply
> force
> > Background to subclass from wxMDIParentFrame and wxMDIChildFrame
> respectively,
> >
> > instead of the wx.Frame class. Once I've done that, wxPython does the
> rest
> >of
> >
> > the work.
> >
> > ################ mod to model.py ######################
> >
> > from wxPython.wx import wxMDIParentFrame, wxMDIChildFrame
> >
> > # Used to say:
> > # class BackgroundBase(Scriptable, wx.Frame, event.EventSource):
> > class BackgroundBase(Scriptable, event.EventSource):
> > """
> > A window that contains Widgets.
> > """
> > def __init__(self, aParent, aBgRsrc, frameclass=wx.Frame):
> > ...<original code>...
> > #Changed original code from invoking wx.Frame here to a method passed
> down
> > # First, call the base class' __init__ method to create the
> frame
> > frameclass.__init__(self, aParent,
> > self.id,
> > #self.name,
> > aBgRsrc.title,
> > position,
> > aBgRsrc.size,
> > style | wx.NO_FULL_REPAINT_ON_RESIZE,
> > aBgRsrc.name)
> > ...<rest of original code>...
> >
> >
> > class Background(BackgroundBase, wx.Frame):
> > def __init__(self, aParent, aBgRsrc):
> > return BackgroundBase.__init__(self, aParent, aBgRsrc,
> > frameclass=wx.Frame)
> >
> > class MDIParentBackground(BackgroundBase, wxMDIParentFrame):
> > def __init__(self, aParent, aBgRsrc):
> > return BackgroundBase.__init__(self, aParent, aBgRsrc,
> > frameclass=wxMDIParentFrame)
> >
> > class MDIChildBackground(BackgroundBase, wxMDIChildFrame):
> > def __init__(self, aParent, aBgRsrc):
> > return BackgroundBase.__init__(self, aParent, aBgRsrc,
> > frameclass=wxMDIChildFrame)
> >
> > ############## end of mod to model.py #########################
> >
> > To use these two new classes, the code is remarkably unremarkable. The
> parent
> >
> > code:
> >
> > ############# Parent ######################
> > #!/usr/bin/python
> >
> > """
> > __version__ = "$Revision: 1.5 $"
> > __date__ = "$Date: 2004/04/30 16:26:12 $"
> > """
> >
> > from PythonCard import model
> >
> > MDI_rsrc=\
> > {'application':{'type':'Application',
> > 'name':'Template',
> > 'backgrounds': [
> > {'type':'Background',
> > 'name':'bgTemplate',
> > 'title':'Testing MDI Controls',
> > 'size':(400, 300),
> > 'style':['resizeable'],
> >
> > 'menubar': {'type':'MenuBar',
> > 'menus': [
> > {'type':'Menu',
> > 'name':'menuFile',
> > 'label':'&File',
> > 'items': [
> > {'type':'MenuItem',
> > 'name':'menuFileExit',
> > 'label':'E&xit',
> > 'command':'exit',
> > },
> > ]
> > },
> > {'type':'Menu',
> > 'name':'menuOptions',
> > 'label':'Options',
> > 'items': [
> > {'type':'MenuItem',
> > 'name':'menuOptionsOpenNew',
> > 'label':'Open New\tAlt+N',
> > 'command':'openNew',
> > },
> > ]
> > },
> > ]
> > },
> > 'components': [
> >
> > ] # end components
> > } # end background
> > ] # end backgrounds
> > } }
> >
> > MyCW_rsrc=\
> > {'application':{'type':'Application',
> > 'name':'Template',
> > 'backgrounds': [
> > {'type':'Background',
> > 'name':'bgTemplate',
> > 'title':'Standard Template with File->Exit menu',
> > 'size':(698, 517),
> > 'style':['resizeable'],
> >
> > 'menubar': {'type':'MenuBar',
> > 'menus': [
> > {'type':'Menu',
> > 'name':'menuFile',
> > 'label':'&File',
> > 'items': [
> > {'type':'MenuItem',
> > 'name':'menuFileExit',
> > 'label':'E&xit',
> > 'command':'exit',
> > },
> > ]
> > },
> > {'type':'Menu',
> > 'name':'menuOptions',
> > 'label':'Options',
> > 'items': [
> > {'type':'MenuItem',
> > 'name':'menuOptionsOpenNew',
> > 'label':'Open New\tAlt+N',
> > 'command':'openNew',
> > },
> > ]
> > },
> > ]
> > },
> > 'components': [
> >
> > {'type':'TextArea',
> > 'name':'TextArea1',
> > 'position':(20, 20),
> > 'size':(651, 333),
> > },
> >
> > {'type':'Button',
> > 'name':'Button1',
> > 'position':(559, 376),
> > 'label':'Button1',
> > },
> >
> > ] # end components
> > } # end background
> > ] # end backgrounds
> > } }
> >
> > class MyBackground(model.MDIParentBackground):
> >
> > def on_initialize(self, event):
> > # if you have any initialization
> > # including sizer setup, do it here
> > #MDI.on_initialize(self, event)
> > pass
> > def on_openNew_command ( self, event ):
> > # Create a child window
> > child = model.childWindow(self, MyCW, rsrc=MyCW_rsrc)
> >
> > if __name__ == '__main__':
> > app = model.Application(MyBackground, None, MDI_rsrc)
> > app.MainLoop()
> > ############# End of Parent ######################
> >
> > ############# Child ######################
> > class MyCW(model.MDIChildBackground):
> >
> > def on_initialize(self, event):
> > self.parent = self.getParent()
> > self.components.TextArea1.text='I am only a child.'
> > def on_openNew_command ( self, event ):
> > return self.parent.on_openNew_command ( event )
> > ############# End of Child ######################
> >
> > That's it!!!
> >
> > Now I have to play around with resizer to see how that would work here.
> >
> > --
> > John Henry
> >
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
>
> _______________________________________________
> Pythoncard-users mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>
>
--
Mark Carter, OCT
markcarter.tel
--
Mark Carter, OCT
markcarter.tel
|
|
From: John H. <ec...@ya...> - 2011-04-01 22:43:53
|
I couldn't agree with you more. Earlier there was a post claiming that he
prefers wxPython over Pythoncard. I assume he's using a different animal than
the one I am looking at. Pythoncard is simple, feature rich - and very stable.
I've done numerous projects using Pythoncard.
I've long suggested that somebody release a 1.0 version of Pythoncard. So far,
it has fallen to death ears. If we can all convince the owner to do that, I
can package up what I have done and contribute to the release.
I've hecked together the following controls:
pdfwindow, flashwindow, tree control, minimizable window (minimize to Windows
lauch bar), MDI parent and child windows, sashwindows, ...
I have to stress heck because I did all these kind of blind folded because I
really don't know what's going on most of the time. Wing debugger is my friend.
Controls I tried but unable to get it to work:
matplotlib window, a graphic file viewer widget (works but not behaving
properly), a MDI widget (not window).
--
John Henry
>
>From: Mark Carter <ma...@ma...>
>To: pyt...@li...
>Sent: Fri, April 1, 2011 9:13:02 AM
>Subject: [Pythoncard-users] Added MDI support to Pythoncard (was MDI -
>childwindows within a window)
>
>
>Hi John.
>
>Awesome! Good to know someone is still developing PythonCard! PythonCard is
>really a super project, for infrequent programmers like myself looking for a
>Visual Basic-like development experience on Python, PythonCard does the job.
>
>I don't suppose you could shepherd through a new release? The current release
>is several years old IIRC, and the installer has issues (either with Vista
>and/or latest Python, can't recall). Most people who research PythonCard these
>days just assume it's a dead project.
>
>Mark
>
>
>
>On Fri, Apr 1, 2011 at 10:53 AM, John Henry <ec...@ya...> wrote:
>
>I am happy to report that I've succeeded in Pythoncardize
>>the wx.SashLayoutWindow control of wxPython
>> using similar technique to the MDI support I reported previously. Not sure
>if
>>the screen capture attachment to this email will get stripped or not. If you
>>don't see the screen shot, shout and I'll try to upload that somewhere.
>>
>>########## mod to model.py #######################
>>class Background(BackgroundBase, wx.Frame):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>>frameclass=wx.Frame, init=init)
>>
>>class MDIChildBackground(BackgroundBase, wx.MDIChildFrame):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>>frameclass=wx.MDIChildFrame, init=init)
>>
>>class MDIParentBackground(BackgroundBase, wx.MDIParentFrame):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>>frameclass=wx.MDIParentFrame, init=init)
>>
>>class SashWindow(BackgroundBase, wx.SashLayoutWindow):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> rsrc = resource.Resource(aBgRsrc).application.backgrounds[0]
>> return BackgroundBase.__init__(self, aParent, rsrc,
>>frameclass=wx.SashLayoutWindow, init=init)
>> # Dummy routine
>> def SetMenuBar(self, child):
>> return
>> # Dummy routine
>> def GetStatusBar(self):
>> return
>>########## end of mod to model.py #######################--
>>John Henry
>>
>>
>>
>>----- Original Message ----
>>> From: John Henry <ec...@ya...>
>>> To: pyt...@li...
>>> Sent: Wed, March 9, 2011 10:08:39 AM
>>> Subject: Added MDI support to Pythoncard (was MDI - childwindows within a
>>>window)
>>>
>>> I am happy to let you know that I succeeded in adding MDI support to
>>Pythoncard
>>>
>>> with only a few lines of modifications to the Background class in model.py
>>>
>>> I made the Background class into a BackgroundBase class, and have the
>>>Background
>>>
>>> class subclass from the BackgroundBase class.
>>>
>>> Then I added a MDIParentBackground and MDIChildBackground which simply
force
>>> Background to subclass from wxMDIParentFrame and wxMDIChildFrame
>>respectively,
>>>
>>> instead of the wx.Frame class. Once I've done that, wxPython does the
rest
>>>of
>>>
>>> the work.
>>>
>>> ################ mod to model.py ######################
>>>
>>> from wxPython.wx import wxMDIParentFrame, wxMDIChildFrame
>>>
>>> # Used to say:
>>> # class BackgroundBase(Scriptable, wx.Frame, event.EventSource):
>>> class BackgroundBase(Scriptable, event.EventSource):
>>> """
>>> A window that contains Widgets.
>>> """
>>> def __init__(self, aParent, aBgRsrc, frameclass=wx.Frame):
>>> ...<original code>...
>>> #Changed original code from invoking wx.Frame here to a method passed down
>>> # First, call the base class' __init__ method to create the frame
>>> frameclass.__init__(self, aParent,
>>> self.id,
>>> #self.name,
>>> aBgRsrc.title,
>>> position,
>>> aBgRsrc.size,
>>> style | wx.NO_FULL_REPAINT_ON_RESIZE,
>>> aBgRsrc.name)
>>> ...<rest of original code>...
>>>
>>>
>>> class Background(BackgroundBase, wx.Frame):
>>> def __init__(self, aParent, aBgRsrc):
>>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>>> frameclass=wx.Frame)
>>>
>>> class MDIParentBackground(BackgroundBase, wxMDIParentFrame):
>>> def __init__(self, aParent, aBgRsrc):
>>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>>> frameclass=wxMDIParentFrame)
>>>
>>> class MDIChildBackground(BackgroundBase, wxMDIChildFrame):
>>> def __init__(self, aParent, aBgRsrc):
>>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>>> frameclass=wxMDIChildFrame)
>>>
>>> ############## end of mod to model.py #########################
>>>
>>> To use these two new classes, the code is remarkably unremarkable. The
>>parent
>>>
>>> code:
>>>
>>> ############# Parent ######################
>>> #!/usr/bin/python
>>>
>>> """
>>> __version__ = "$Revision: 1.5 $"
>>> __date__ = "$Date: 2004/04/30 16:26:12 $"
>>> """
>>>
>>> from PythonCard import model
>>>
>>> MDI_rsrc=\
>>> {'application':{'type':'Application',
>>> 'name':'Template',
>>> 'backgrounds': [
>>> {'type':'Background',
>>> 'name':'bgTemplate',
>>> 'title':'Testing MDI Controls',
>>> 'size':(400, 300),
>>> 'style':['resizeable'],
>>>
>>> 'menubar': {'type':'MenuBar',
>>> 'menus': [
>>> {'type':'Menu',
>>> 'name':'menuFile',
>>> 'label':'&File',
>>> 'items': [
>>> {'type':'MenuItem',
>>> 'name':'menuFileExit',
>>> 'label':'E&xit',
>>> 'command':'exit',
>>> },
>>> ]
>>> },
>>> {'type':'Menu',
>>> 'name':'menuOptions',
>>> 'label':'Options',
>>> 'items': [
>>> {'type':'MenuItem',
>>> 'name':'menuOptionsOpenNew',
>>> 'label':'Open New\tAlt+N',
>>> 'command':'openNew',
>>> },
>>> ]
>>> },
>>> ]
>>> },
>>> 'components': [
>>>
>>> ] # end components
>>> } # end background
>>> ] # end backgrounds
>>> } }
>>>
>>> MyCW_rsrc=\
>>> {'application':{'type':'Application',
>>> 'name':'Template',
>>> 'backgrounds': [
>>> {'type':'Background',
>>> 'name':'bgTemplate',
>>> 'title':'Standard Template with File->Exit menu',
>>> 'size':(698, 517),
>>> 'style':['resizeable'],
>>>
>>> 'menubar': {'type':'MenuBar',
>>> 'menus': [
>>> {'type':'Menu',
>>> 'name':'menuFile',
>>> 'label':'&File',
>>> 'items': [
>>> {'type':'MenuItem',
>>> 'name':'menuFileExit',
>>> 'label':'E&xit',
>>> 'command':'exit',
>>> },
>>> ]
>>> },
>>> {'type':'Menu',
>>> 'name':'menuOptions',
>>> 'label':'Options',
>>> 'items': [
>>> {'type':'MenuItem',
>>> 'name':'menuOptionsOpenNew',
>>> 'label':'Open New\tAlt+N',
>>> 'command':'openNew',
>>> },
>>> ]
>>> },
>>> ]
>>> },
>>> 'components': [
>>>
>>> {'type':'TextArea',
>>> 'name':'TextArea1',
>>> 'position':(20, 20),
>>> 'size':(651, 333),
>>> },
>>>
>>> {'type':'Button',
>>> 'name':'Button1',
>>> 'position':(559, 376),
>>> 'label':'Button1',
>>> },
>>>
>>> ] # end components
>>> } # end background
>>> ] # end backgrounds
>>> } }
>>>
>>> class MyBackground(model.MDIParentBackground):
>>>
>>> def on_initialize(self, event):
>>> # if you have any initialization
>>> # including sizer setup, do it here
>>> #MDI.on_initialize(self, event)
>>> pass
>>> def on_openNew_command ( self, event ):
>>> # Create a child window
>>> child = model.childWindow(self, MyCW, rsrc=MyCW_rsrc)
>>>
>>> if __name__ == '__main__':
>>> app = model.Application(MyBackground, None, MDI_rsrc)
>>> app.MainLoop()
>>> ############# End of Parent ######################
>>>
>>> ############# Child ######################
>>> class MyCW(model.MDIChildBackground):
>>>
>>> def on_initialize(self, event):
>>> self.parent = self.getParent()
>>> self.components.TextArea1.text='I am only a child.'
>>> def on_openNew_command ( self, event ):
>>> return self.parent.on_openNew_command ( event )
>>> ############# End of Child ######################
>>>
>>> That's it!!!
>>>
>>> Now I have to play around with resizer to see how that would work here.
>>>
>>> --
>>> John Henry
>>>
>>------------------------------------------------------------------------------
>>Create and publish websites with WebMatrix
>>Use the most popular FREE web apps or write code yourself;
>>WebMatrix provides all the features you need to develop and
>>publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
>>
>>_______________________________________________
>>Pythoncard-users mailing list
>>Pyt...@li...
>>https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>>
>>
>
>
>--
>Mark Carter, OCT
>markcarter.tel
>
>
>
>--
>Mark Carter, OCT
>markcarter.tel
> |
|
From: Teuvo E. <te...@gm...> - 2011-04-02 09:29:33
|
Hi there!
It's so nice to hear people using Pythoncard, not to mention someone is
(willing to) developing it.
I think Pythoncard is an absolute superb tool for making GUI programs.
Amazingly fast method and produces code more readable (and short) than any
other (at least that i know of).
I've done something earlier with wxPython, but usually it's "too much" for
what I need, Pythoncard is definitely the nbr one tool I use for GUI
programs.
And when necessary, the missing pieces can be coded with wxPython still.
For the developer, and everyone involved somehow for making pythoncard what
it is today - thank you!
Just wanted to add my 5 cents too :)
-Teuvo
2011/4/2 John Henry <ec...@ya...>
> I couldn't agree with you more. Earlier there was a post claiming that he
> prefers wxPython over Pythoncard. I assume he's using a different animal
> than the one I am looking at. Pythoncard is simple, feature rich - and very
> stable. I've done numerous projects using Pythoncard.
>
> I've long suggested that somebody release a 1.0 version of Pythoncard. So
> far, it has fallen to death ears. If we can all convince the owner to do
> that, I can package up what I have done and contribute to the release.
>
> I've hecked together the following controls:
>
> pdfwindow, flashwindow, tree control, minimizable window (minimize to
> Windows lauch bar), MDI parent and child windows, sashwindows, ...
>
> I have to stress heck because I did all these kind of blind folded because
> I really don't know what's going on most of the time. Wing debugger is my
> friend.
>
> Controls I tried but unable to get it to work:
>
> matplotlib window, a graphic file viewer widget (works but not behaving
> properly), a MDI widget (not window).
>
>
>
> --
> John Henry
>
>
> *From:* Mark Carter <ma...@ma...>
>
> *To:* pyt...@li...
> *Sent:* Fri, April 1, 2011 9:13:02 AM
> *Subject:* [Pythoncard-users] Added MDI support to Pythoncard (was MDI -
> childwindows within a window)
>
> Hi John.
>
> Awesome! Good to know someone is still developing PythonCard! PythonCard
> is really a super project, for infrequent programmers like myself looking
> for a Visual Basic-like development experience on Python, PythonCard does
> the job.
>
> I don't suppose you could shepherd through a new release? The current
> release is several years old IIRC, and the installer has issues (either with
> Vista and/or latest Python, can't recall). Most people who research
> PythonCard these days just assume it's a dead project.
>
> Mark
>
>
> On Fri, Apr 1, 2011 at 10:53 AM, John Henry <ec...@ya...> wrote:
>
>> I am happy to report that I've succeeded in Pythoncardize
>> the wx.SashLayoutWindow control of wxPython
>> using similar technique to the MDI support I reported previously. Not
>> sure if
>> the screen capture attachment to this email will get stripped or not. If
>> you
>> don't see the screen shot, shout and I'll try to upload that somewhere.
>>
>> ########## mod to model.py #######################
>> class Background(BackgroundBase, wx.Frame):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>> frameclass=wx.Frame, init=init)
>>
>> class MDIChildBackground(BackgroundBase, wx.MDIChildFrame):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>> frameclass=wx.MDIChildFrame, init=init)
>>
>> class MDIParentBackground(BackgroundBase, wx.MDIParentFrame):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> return BackgroundBase.__init__(self, aParent, aBgRsrc,
>> frameclass=wx.MDIParentFrame, init=init)
>>
>> class SashWindow(BackgroundBase, wx.SashLayoutWindow):
>> def __init__(self, aParent, aBgRsrc, init=None):
>> rsrc = resource.Resource(aBgRsrc).application.backgrounds[0]
>> return BackgroundBase.__init__(self, aParent, rsrc,
>> frameclass=wx.SashLayoutWindow, init=init)
>> # Dummy routine
>> def SetMenuBar(self, child):
>> return
>> # Dummy routine
>> def GetStatusBar(self):
>> return
>> ########## end of mod to model.py #######################--
>> John Henry
>>
>>
>>
>> ----- Original Message ----
>> > From: John Henry <ec...@ya...>
>> > To: pyt...@li...
>> > Sent: Wed, March 9, 2011 10:08:39 AM
>> > Subject: Added MDI support to Pythoncard (was MDI - childwindows within
>> a
>> >window)
>> >
>> > I am happy to let you know that I succeeded in adding MDI support to
>> Pythoncard
>> >
>> > with only a few lines of modifications to the Background class in
>> model.py
>> >
>> > I made the Background class into a BackgroundBase class, and have the
>> >Background
>> >
>> > class subclass from the BackgroundBase class.
>> >
>> > Then I added a MDIParentBackground and MDIChildBackground which simply
>> force
>> > Background to subclass from wxMDIParentFrame and wxMDIChildFrame
>> respectively,
>> >
>> > instead of the wx.Frame class. Once I've done that, wxPython does the
>> rest
>> >of
>> >
>> > the work.
>> >
>> > ################ mod to model.py ######################
>> >
>> > from wxPython.wx import wxMDIParentFrame, wxMDIChildFrame
>> >
>> > # Used to say:
>> > # class BackgroundBase(Scriptable, wx.Frame, event.EventSource):
>> > class BackgroundBase(Scriptable, event.EventSource):
>> > """
>> > A window that contains Widgets.
>> > """
>> > def __init__(self, aParent, aBgRsrc, frameclass=wx.Frame):
>> > ...<original code>...
>> > #Changed original code from invoking wx.Frame here to a method passed
>> down
>> > # First, call the base class' __init__ method to create the
>> frame
>> > frameclass.__init__(self, aParent,
>> > self.id,
>> > #self.name,
>> > aBgRsrc.title,
>> > position,
>> > aBgRsrc.size,
>> > style | wx.NO_FULL_REPAINT_ON_RESIZE,
>> > aBgRsrc.name)
>> > ...<rest of original code>...
>> >
>> >
>> > class Background(BackgroundBase, wx.Frame):
>> > def __init__(self, aParent, aBgRsrc):
>> > return BackgroundBase.__init__(self, aParent, aBgRsrc,
>> > frameclass=wx.Frame)
>> >
>> > class MDIParentBackground(BackgroundBase, wxMDIParentFrame):
>> > def __init__(self, aParent, aBgRsrc):
>> > return BackgroundBase.__init__(self, aParent, aBgRsrc,
>> > frameclass=wxMDIParentFrame)
>> >
>> > class MDIChildBackground(BackgroundBase, wxMDIChildFrame):
>> > def __init__(self, aParent, aBgRsrc):
>> > return BackgroundBase.__init__(self, aParent, aBgRsrc,
>> > frameclass=wxMDIChildFrame)
>> >
>> > ############## end of mod to model.py #########################
>> >
>> > To use these two new classes, the code is remarkably unremarkable. The
>> parent
>> >
>> > code:
>> >
>> > ############# Parent ######################
>> > #!/usr/bin/python
>> >
>> > """
>> > __version__ = "$Revision: 1.5 $"
>> > __date__ = "$Date: 2004/04/30 16:26:12 $"
>> > """
>> >
>> > from PythonCard import model
>> >
>> > MDI_rsrc=\
>> > {'application':{'type':'Application',
>> > 'name':'Template',
>> > 'backgrounds': [
>> > {'type':'Background',
>> > 'name':'bgTemplate',
>> > 'title':'Testing MDI Controls',
>> > 'size':(400, 300),
>> > 'style':['resizeable'],
>> >
>> > 'menubar': {'type':'MenuBar',
>> > 'menus': [
>> > {'type':'Menu',
>> > 'name':'menuFile',
>> > 'label':'&File',
>> > 'items': [
>> > {'type':'MenuItem',
>> > 'name':'menuFileExit',
>> > 'label':'E&xit',
>> > 'command':'exit',
>> > },
>> > ]
>> > },
>> > {'type':'Menu',
>> > 'name':'menuOptions',
>> > 'label':'Options',
>> > 'items': [
>> > {'type':'MenuItem',
>> > 'name':'menuOptionsOpenNew',
>> > 'label':'Open New\tAlt+N',
>> > 'command':'openNew',
>> > },
>> > ]
>> > },
>> > ]
>> > },
>> > 'components': [
>> >
>> > ] # end components
>> > } # end background
>> > ] # end backgrounds
>> > } }
>> >
>> > MyCW_rsrc=\
>> > {'application':{'type':'Application',
>> > 'name':'Template',
>> > 'backgrounds': [
>> > {'type':'Background',
>> > 'name':'bgTemplate',
>> > 'title':'Standard Template with File->Exit menu',
>> > 'size':(698, 517),
>> > 'style':['resizeable'],
>> >
>> > 'menubar': {'type':'MenuBar',
>> > 'menus': [
>> > {'type':'Menu',
>> > 'name':'menuFile',
>> > 'label':'&File',
>> > 'items': [
>> > {'type':'MenuItem',
>> > 'name':'menuFileExit',
>> > 'label':'E&xit',
>> > 'command':'exit',
>> > },
>> > ]
>> > },
>> > {'type':'Menu',
>> > 'name':'menuOptions',
>> > 'label':'Options',
>> > 'items': [
>> > {'type':'MenuItem',
>> > 'name':'menuOptionsOpenNew',
>> > 'label':'Open New\tAlt+N',
>> > 'command':'openNew',
>> > },
>> > ]
>> > },
>> > ]
>> > },
>> > 'components': [
>> >
>> > {'type':'TextArea',
>> > 'name':'TextArea1',
>> > 'position':(20, 20),
>> > 'size':(651, 333),
>> > },
>> >
>> > {'type':'Button',
>> > 'name':'Button1',
>> > 'position':(559, 376),
>> > 'label':'Button1',
>> > },
>> >
>> > ] # end components
>> > } # end background
>> > ] # end backgrounds
>> > } }
>> >
>> > class MyBackground(model.MDIParentBackground):
>> >
>> > def on_initialize(self, event):
>> > # if you have any initialization
>> > # including sizer setup, do it here
>> > #MDI.on_initialize(self, event)
>> > pass
>> > def on_openNew_command ( self, event ):
>> > # Create a child window
>> > child = model.childWindow(self, MyCW, rsrc=MyCW_rsrc)
>> >
>> > if __name__ == '__main__':
>> > app = model.Application(MyBackground, None, MDI_rsrc)
>> > app.MainLoop()
>> > ############# End of Parent ######################
>> >
>> > ############# Child ######################
>> > class MyCW(model.MDIChildBackground):
>> >
>> > def on_initialize(self, event):
>> > self.parent = self.getParent()
>> > self.components.TextArea1.text='I am only a child.'
>> > def on_openNew_command ( self, event ):
>> > return self.parent.on_openNew_command ( event )
>> > ############# End of Child ######################
>> >
>> > That's it!!!
>> >
>> > Now I have to play around with resizer to see how that would work here.
>> >
>> > --
>> > John Henry
>> >
>>
>> ------------------------------------------------------------------------------
>> Create and publish websites with WebMatrix
>> Use the most popular FREE web apps or write code yourself;
>> WebMatrix provides all the features you need to develop and
>> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
>>
>> _______________________________________________
>> Pythoncard-users mailing list
>> Pyt...@li...
>> https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>>
>>
>
>
> --
> Mark Carter, OCT
> markcarter.tel
>
>
>
>
> --
> Mark Carter, OCT
> markcarter.tel
>
>
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
>
> _______________________________________________
> Pythoncard-users mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pythoncard-users
>
>
|
|
From: Alec B. <wry...@gm...> - 2011-04-03 05:05:59
|
Just wanted to chime in that I too love PythonCard. I started using it before I knew how to code in wxPython, and now that I'm pretty comfortable in wxPython I still use and love PythonCard, especially for quickies. I'd love to see more development done on it, and since at the moment I don't have any time, would be more than willing to donate some $$ if that was the sort of thing that might help make it worthwhile for someone to work a new release with these new features. On Sat, Apr 2, 2011 at 9:47 PM, John Henry <ec...@ya...> wrote: > I evaluated Dado and yes, for what it does, it does it very well. For > myself, > I > don't need database features. I just need simple User Interfacing. For > that, > Pythoncard fits my bill. I've probe around Pythoncard enough that if I > need a > new control, I can crank one out without too much trouble (exact the ones I > couldn't get working - as listed in previous emails). > > I believe for most people that just need quick User Interfacing type of > applications, Pythoncard remains a viable option. I've benefited greatly > from > Pythoncard and so within my limited ability, I am happy that I can > contribute > (a > little) > -- > John Henry > > > > ----- Original Message ---- > > From: Peter Decker <pyd...@gm...> > > To: Kael Fischer <kae...@gm...> > > Cc: pyt...@li... > > Sent: Sat, April 2, 2011 10:27:24 AM > > Subject: Re: [Pythoncard-users] Added MDI support to Pythoncard (was MDI > - > >childwindows within a window) > > > > On Sat, Apr 2, 2011 at 1:11 PM, Kael Fischer <kae...@gm...> > wrote: > > > Python card is great. > > > > > > But I caution people stating out on large computationally or database > > > intensive projects that while pythoncard makes the easy stuff very > > > easy, it makes that hard stuff harder. Note that even using wxPython > > > getting the process-based and thread-based multitasking working > > > properly can be hard and is essential in any program that uses the > > > cpu, disk and network intensively and still needs wx to be responsive, > > > draw progress bars, etc. > > > > > > I'm warning about big data here (for a GUI anyway): trees with > > > 1000's-10,000's of nodes, grid data stores with ~1M cells. > > > > > > I've written some cool programs in python card, but they never scaled > well. > > > > I used PythonCard for a few projects, and was impressed by how easy it > > was to put together a simple app. But I know exactly what you mean > > about scaling. And while I don't do heavy database apps, I do have to > > save settings, configurations, etc., and this was a very manual > > process in PythonCard. > > > > After I discovered Dabo a few years ago, I have only used PythonCard > > occasionally, and each time I find myself missing Dabo. It's a much > > cleaner wrapper around wxPython, and it comes with data binding built > > in. And to get back to the subject, MDI forms have been a part of Dabo > > since the beginning. > > > > Dabo is still being actively developed, and its user base is growing > > all the time. You should definitely give it a try (and no, they don't > > pay me to say this! I'm just a big fan!). http://dabodev.com > > > > -- > > > > # p.d. > > > > > ------------------------------------------------------------------------------ > > Create and publish websites with WebMatrix > > Use the most popular FREE web apps or write code yourself; > > WebMatrix provides all the features you need to develop and > > publish your website. http://p.sf.net/sfu/ms-webmatrix-sf > > _______________________________________________ > > Pythoncard-users mailing list > > Pyt...@li... > > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > > > > > ------------------------------------------------------------------------------ > Create and publish websites with WebMatrix > Use the most popular FREE web apps or write code yourself; > WebMatrix provides all the features you need to develop and > publish your website. http://p.sf.net/sfu/ms-webmatrix-sf > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > |
|
From: John H. <ec...@ya...> - 2011-04-03 23:05:20
|
That's nice. May be the owner can be motivated. Anyway, I uploaded my mode for supporting MDI at https://sourceforge.net/tracker/?group_id=19015&atid=369015 If interested, please give it a try and let me know if it works for you or not. -- John Henry > >From: Alec Bennett <wry...@gm...> >To: John Henry <kim...@ya...> >Cc: John Henry <ec...@ya...>; pyt...@li... >Sent: Sat, April 2, 2011 10:05:51 PM >Subject: Re: [Pythoncard-users] Added MDI support to Pythoncard (was MDI - >childwindows within a window) > >Just wanted to chime in that I too love PythonCard. I started using it before I >knew how to code in wxPython, and now that I'm pretty comfortable in wxPython I >still use and love PythonCard, especially for quickies. > >I'd love to see more development done on it, and since at the moment I don't >have any time, would be more than willing to donate some $$ if that was the sort >of thing that might help make it worthwhile for someone to work a new release >with these new features. > > > > > > > > > >On Sat, Apr 2, 2011 at 9:47 PM, John Henry <ec...@ya...> wrote: > >I evaluated Dado and yes, for what it does, it does it very well. For myself, >>I >>don't need database features. I just need simple User Interfacing. For that, >>Pythoncard fits my bill. I've probe around Pythoncard enough that if I need a >>new control, I can crank one out without too much trouble (exact the ones I >>couldn't get working - as listed in previous emails). >> >>I believe for most people that just need quick User Interfacing type of >>applications, Pythoncard remains a viable option. I've benefited greatly from >>Pythoncard and so within my limited ability, I am happy that I can contribute >>(a >>little) >> -- >>John Henry >> >> >> >> >>----- Original Message ---- >>> From: Peter Decker <pyd...@gm...> >>> To: Kael Fischer <kae...@gm...> >>> Cc: pyt...@li... >>> Sent: Sat, April 2, 2011 10:27:24 AM >>> Subject: Re: [Pythoncard-users] Added MDI support to Pythoncard (was MDI - >>>childwindows within a window) >>> >> >>> On Sat, Apr 2, 2011 at 1:11 PM, Kael Fischer <kae...@gm...> wrote: >>> > Python card is great. >>> > >>> > But I caution people stating out on large computationally or database >>> > intensive projects that while pythoncard makes the easy stuff very >>> > easy, it makes that hard stuff harder. Note that even using wxPython >>> > getting the process-based and thread-based multitasking working >>> > properly can be hard and is essential in any program that uses the >>> > cpu, disk and network intensively and still needs wx to be responsive, >>> > draw progress bars, etc. >>> > >>> > I'm warning about big data here (for a GUI anyway): trees with >>> > 1000's-10,000's of nodes, grid data stores with ~1M cells. >>> > >>> > I've written some cool programs in python card, but they never scaled >well. >>> >>> I used PythonCard for a few projects, and was impressed by how easy it >>> was to put together a simple app. But I know exactly what you mean >>> about scaling. And while I don't do heavy database apps, I do have to >>> save settings, configurations, etc., and this was a very manual >>> process in PythonCard. >>> >>> After I discovered Dabo a few years ago, I have only used PythonCard >>> occasionally, and each time I find myself missing Dabo. It's a much >>> cleaner wrapper around wxPython, and it comes with data binding built >>> in. And to get back to the subject, MDI forms have been a part of Dabo >>> since the beginning. >>> >>> Dabo is still being actively developed, and its user base is growing >>> all the time. You should definitely give it a try (and no, they don't >>> pay me to say this! I'm just a big fan!). http://dabodev.com >>> >>> -- >>> >>> # p.d. >>> >>> >------------------------------------------------------------------------------ >>> Create and publish websites with WebMatrix >>> Use the most popular FREE web apps or write code yourself; >>> WebMatrix provides all the features you need to develop and >>> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf >>> _______________________________________________ >>> Pythoncard-users mailing list >>> Pyt...@li... >>> https://lists.sourceforge.net/lists/listinfo/pythoncard-users >>> >> >>------------------------------------------------------------------------------ >>Create and publish websites with WebMatrix >>Use the most popular FREE web apps or write code yourself; >>WebMatrix provides all the features you need to develop and >>publish your website. http://p.sf.net/sfu/ms-webmatrix-sf >>_______________________________________________ >>Pythoncard-users mailing list >>Pyt...@li... >>https://lists.sourceforge.net/lists/listinfo/pythoncard-users >> > |
|
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2011-04-12 12:10:11
|
On 12/4/11 03:12, hwg wrote: > On Mac it seems the FontDialog does not work properly. When you try to > open the font dialog, it flashes on the screen for a split second (in > the lower right corner), then disappears. > > The same code run in Windows works fine. The only Mac I have with PythonCard installed at the moment is an old G3 iMac + OSX 10.4.11 + Python 2.5.1 + wxPython 2.8.9.2. Your example works OK on that when I run it, except the following warning appears in the Terminal 3 times when I first open the font dialog: Python [2621] Unknown class NSTypographyPanelSlider in InterfaceBuilder file -- XXXXXXXXXXX |
|
From: Teuvo E. <te...@gm...> - 2011-04-12 12:57:11
|
Hi Neil, I don't have a mac, but perhaps you can try if calling directly the wxPython code works. I assume this should work in mac too: ----------- from wx import ColourDialog, ID_OK dlg = ColourDialog(self) dlg.GetColourData().SetChooseFull(True) if dlg.ShowModal() == ID_OK: sColor = dlg.GetColourData().GetColour() dlg.Destroy() print sColor ----------- Not sure if this ref. code helps you, or anyone listening to find out what is the real problem... but if this does work for you and all else fails, maybe you can use this kind of code in you app. -Teuvo 2011/4/12 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > On 12/4/11 03:12, hwg wrote: > > On Mac it seems the FontDialog does not work properly. When you try to > > open the font dialog, it flashes on the screen for a split second (in > > the lower right corner), then disappears. > > > > The same code run in Windows works fine. > > The only Mac I have with PythonCard installed at the moment is an old G3 > iMac + OSX 10.4.11 + Python 2.5.1 + wxPython 2.8.9.2. Your example works > OK on that when I run it, except the following warning appears in the > Terminal 3 times when I first open the font dialog: > > Python [2621] Unknown class NSTypographyPanelSlider in InterfaceBuilder > file > > -- > XXXXXXXXXXX > > |