This is de code generated by boa constructor :
import wx
import wx.lib.masked.textctrl
def create(parent):
return systems_new(parent)
[wxID_SYSTEMS_NEW, wxID_SYSTEMS_NEWBTNCLOSESYSTEM,
wxID_SYSTEMS_NEWBTNSAVESYSTEM, wxID_SYSTEMS_NEWCREATIONDATE,
wxID_SYSTEMS_NEWCRETATIONDATE, wxID_SYSTEMS_NEWLBLOBSERVATIONS,
wxID_SYSTEMS_NEWSTATICTEXT1, wxID_SYSTEMS_NEWSYSTEMDESCRIPTION,
wxID_SYSTEMS_NEWTXTOBSERVATIONS, wxID_SYSTEMS_NEWTXTSYSDESCRIPTION,
] = [wx.NewId() for _init_ctrls in range(10)]
class systems_new(wx.Frame): ---> I need pass some data to this frame create
inside this class. How i do it?
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_SYSTEMS_NEW, name='systems_new',
parent=prnt, pos=wx.Point(365, 130), size=wx.Size(584, 552),
style=wx.DEFAULT_FRAME_STYLE, title='Systems Form')
self.SetClientSize(wx.Size(576, 525))
self.SetBackgroundColour(wx.Colour(237, 237, 237))
self.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.staticText1 = wx.StaticText(id=wxID_SYSTEMS_NEWSTATICTEXT1,
label='Systems Form', name='staticText1', parent=self,
pos=wx.Point(232, 0), size=wx.Size(112, 24), style=1)
self.staticText1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD,
False, 'Verdana'))
self.staticText1.SetForegroundColour(wx.Colour(170, 43, 47))
self.staticText1.Center(wx.HORIZONTAL)
self.SystemDescription =
wx.StaticText(id=wxID_SYSTEMS_NEWSYSTEMDESCRIPTION,
label='Description :', name='SystemDescription', parent=self,
pos=wx.Point(32, 64), size=wx.Size(77, 14), style=0)
self.SystemDescription.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL,
wx.BOLD,
False, 'Tahoma'))
self.txtsysdescription =
wx.TextCtrl(id=wxID_SYSTEMS_NEWTXTSYSDESCRIPTION,
name='txtsysdescription', parent=self, pos=wx.Point(128, 64),
size=wx.Size(250, 21), style=1, value='')
self.txtsysdescription.SetExtraStyle(-2147483647)
self.txtsysdescription.Enable(True)
self.txtsysdescription.SetToolTipString('System Description')
self.txtsysdescription.SetThemeEnabled(False)
self.CreationDate = wx.StaticText(id=wxID_SYSTEMS_NEWCREATIONDATE,
label='Creation Date :', name='CreationDate', parent=self,
pos=wx.Point(16, 104), size=wx.Size(93, 14), style=0)
self.CreationDate.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD,
False, 'Tahoma'))
self.CretationDate =
wx.lib.masked.textctrl.TextCtrl(id=wxID_SYSTEMS_NEWCRETATIONDATE,
name='CretationDate', parent=self, pos=wx.Point(136, 104),
size=wx.Size(78, 22), style=0, value=' / / ')
self.CretationDate.SetAutoformat('')
self.CretationDate.SetExcludeChars('')
self.CretationDate.SetDatestyle('DMY')
self.CretationDate.SetFormatcodes('DF')
self.CretationDate.SetMask('##/##/####')
self.CretationDate.SetDescription('DD.MM.YYYY 24Hr Time\n(w/o
seconds)')
self.CretationDate.SetValidRegex('^(01|02|03|04|05|06|07|08|09|10|11|12|13|1
4|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31).(01|02|03|04|05|06|07|
08|09|10|11|12).\\d{4}
(00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23):(0
0|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25
26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|
51|52|53|54|55|56|57|58|59)')
self.CretationDate.SetMaxLength(10)
self.lblObservations =
wx.StaticText(id=wxID_SYSTEMS_NEWLBLOBSERVATIONS,
label='Observations :', name='lblObservations', parent=self,
pos=wx.Point(16, 160), size=wx.Size(88, 14), style=0)
self.lblObservations.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL,
wx.BOLD,
False, 'Tahoma'))
self.txtobservations =
wx.TextCtrl(id=wxID_SYSTEMS_NEWTXTOBSERVATIONS,
name='txtobservations', parent=self, pos=wx.Point(120, 160),
size=wx.Size(400, 160), style=0, value='')
self.txtobservations.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL,
wx.NORMAL,
False, 'Tahoma'))
self.btnSaveSystem = wx.Button(id=wxID_SYSTEMS_NEWBTNSAVESYSTEM,
label='Save', name='btnSaveSystem', parent=self,
pos=wx.Point(200,
440), size=wx.Size(75, 23), style=0)
self.btnSaveSystem.Bind(wx.EVT_BUTTON, self.OnBtnSaveSystemButton,
id=wxID_SYSTEMS_NEWBTNSAVESYSTEM)
self.btnCloseSystem = wx.Button(id=wxID_SYSTEMS_NEWBTNCLOSESYSTEM,
label='Close', name='btnCloseSystem', parent=self,
pos=wx.Point(296, 440), size=wx.Size(75, 23), style=0)
self.btnCloseSystem.Bind(wx.EVT_BUTTON, self.OnBtnCloseSystemButton,
id=wxID_SYSTEMS_NEWBTNCLOSESYSTEM)
def __init__(self, parent):
self._init_ctrls(parent)
def OnBtnSaveSystemButton(self, event):
event.Skip()
def OnBtnCloseSystemButton(self, event):
event.Skip()
-----Mensagem original-----
···
De: Saketh Bhamidipati [mailto:saketh.bhamidipati@gmail.com]
Enviada em: sexta-feira, 14 de julho de 2006 13:07
Para: wxPython-users@lists.wxwidgets.org
Assunto: Re: [wxPython-users] How to pass data to a frame
On 7/14/06, Alejandro Michelin Salomon ( Adinet ) <alejmsg@adinet.com.uy> wrote:
I create the menu and menubar.
I have a file that is the main.
The menu bar call a frame tha has a fin process.
What is this "fin" process? I don't understand. Do you mean that the menu
has an item which creates a dialog box, or a child frame? They are two
different things.
After find records, i need call a frame that has a form for the based table.
The problem is that i dont now how to do it.
I now how to call it, but not whith parameters.
I would advise you to create a subclass of whatever you are creating. From
your description, I think you are using a wx.Dialog or a wx.Frame as a child
frame. So let's say you're creating a wx.Dialog, you would want to make your
form dialog a subclass of wx.Dialog:
class FormDialog(wx.Dialog):
def __init__(self, parent, id, title, parameter1, parameter2):
wx.Dialog.__init__(self, parent, id, title)
doSomething(parameter1)
doSomethingElse(parameter2)
def doSomething(self):
...
def doSomethingElse(self):
...
It's the same idea for a wx.Frame, although you'd have to change around the
arguments in the __init__ function. I'm not sure if this is what you want,
though.
If you post your code, we can help you more easily. It's hard to understand
your problem without seeing the code.