Originally posted by bartonc
This does not serve my purpose. I want to set some value in a box thru my script which wud have ,otherwise,been set by clicking on a browse tab and then selecting a file by a mouse click.
#Boa:Frame:Frame2 import wx def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1PANEL1, wxID_FRAME1TEXTCTRL1, ] = [wx.NewId() for _init_ctrls in range(3)] class Frame1(wx.Frame): def _init_sizers(self): # generated method, don't edit self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL) self._init_coll_boxSizer1_Items(self.boxSizer1) self.SetSizer(self.boxSizer1) def _init_coll_boxSizer1_Items(self, parent): # generated method, don't edit parent.AddWindow(self.panel1, 1, border=0, flag=wx.EXPAND) def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(22, 22), size=wx.Size(400, 250), style=wx.DEFAULT_FRAME_STYLE, title='Frame1') self.SetClientSize(wx.Size(392, 223)) self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(392, 223), style=wx.TAB_TRAVERSAL) self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1, name='textCtrl1', parent=self.panel1, pos=wx.Point(16, 72), size=wx.Size(360, 21), style=0, value='') self._init_sizers() def __init__(self, parent): self._init_ctrls(parent)
#!/usr/bin/env python #Boa:App:BoaApp import wx import Frame2 modules ={u'Frame2': [1, 'Main frame of Application', u'Frame2.py']} class BoaApp(wx.App): def OnInit(self): self.main = Frame2.create(None) ## this is NOT good OOP encapulation, but it works ## self.main.textCtrl1.SetValue('this is a test') # # self.main.Show() self.SetTopWindow(self.main) return True def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': main()
Comment