hello,
I'm trying to write a cross platform simulator for PPyGui,
based on wxPython.
So the basic idea is to replace the PPyGui library with a wxPython library,
but I stumbeld over a few constructs for which I can't find a translation:
···
--------------
the first one, (literary from a demo script):
app = gui.Application ( MainFrame () )
It isn't accepted because:
- I can't create a main frame before I've created the application
So as a work around, I changed this in
app = gui.Application(MainFrame)
and let the gui.Application create the MainFrame
-----------------
the second one:
gui.Message.ok ( "About", "Ppygui demo", "info", self)
I tried this
class Message ( object ) :
def __init__ ( self ) :
pass
def ok ( self, caption = '', message = '', parent = None ) :
wx.MessageDialog ( parent, message, caption,
style = wx.OK | wx.ICON_INFORMATION )
But that gives the following error:
unbound method ok() must be called with Message instance as first argument (got str instance instead)
---------------
thanks,
Stef Mientki
Stef Mientki wrote:
I tried this
class Message ( object ) :
def __init__ ( self ) :
pass
def ok ( self, caption = '', message = '', parent = None ) :
wx.MessageDialog ( parent, message, caption,
style = wx.OK | wx.ICON_INFORMATION )
But that gives the following error:
unbound method ok() must be called with Message instance as first argument (got str instance instead)
Did you instantiate a Message instance?
Maybe you want a static method, or just a plain old function in a module.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
Christopher Barker wrote:
Stef Mientki wrote:
I tried this
class Message ( object ) :
def __init__ ( self ) :
pass
def ok ( self, caption = '', message = '', parent = None ) :
wx.MessageDialog ( parent, message, caption,
style = wx.OK | wx.ICON_INFORMATION )
But that gives the following error:
unbound method ok() must be called with Message instance as first argument (got str instance instead)
Did you instantiate a Message instance?
Aha, that seems to problem, the code below works now, Thanks Chris !!
cheers,
Stef
# ***********************************************************************
class _Message ( object ) :
def __init__ ( self ) :
pass
def ok ( self, caption = '', message = '', type = None, parent = None ) :
dialog = wx.MessageDialog ( parent, message, caption,
style = wx.OK | wx.ICON_INFORMATION )
dialog.ShowModal()
dialog.Destroy ()
# ***********************************************************************
# Here we create a global message instance
Message = _Message ()