[ BigBrother2005 @ 02.10.2005. 15:58 ] @
Za ovaj primer potreban vam je wxPython Prvo imamo skelet aplikacije koji treba sacuvati kao: App1.pyw Code: import wx import Frame1 modules ={'Frame1': [1, 'Main frame of Application', u'Frame1.py']} class BoaApp(wx.App): def OnInit(self): wx.InitAllImageHandlers() self.main = Frame1.create(None) self.main.Show() self.SetTopWindow(self.main) return True def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': main() Onda dolazi frame,tj forma, bitno je da naziv bude isti kao import u skeletu aplikacije Code: import wx import wx.html def create(parent): return Frame1(parent) [wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1GENERICDIRCTRL1, wxID_FRAME1HTMLWINDOW1, ] = [wx.NewId() for _init_ctrls in range(4)] class Frame1(wx.Frame): def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt, pos=wx.Point(5, 228), size=wx.Size(878, 492), style=wx.DEFAULT_FRAME_STYLE, title='Frame1') self.SetClientSize(wx.Size(870, 465)) self.SetAutoLayout(True) self.htmlWindow1 = wx.html.HtmlWindow(id=wxID_FRAME1HTMLWINDOW1, name='htmlWindow1', parent=self, pos=wx.Point(16, 56), size=wx.Size(560, 392), style=wx.VSCROLL | wx.MAXIMIZE_BOX | wx.html.HW_SCROLLBAR_AUTO) self.htmlWindow1.SetThemeEnabled(False) self.htmlWindow1.SetExtraStyle(0) self.htmlWindow1.Show(True) self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label=u'Ucitaj Stranu', name='button1', parent=self, pos=wx.Point(144, 16), size=wx.Size(91, 31), style=0) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=wxID_FRAME1BUTTON1) self.genericDirCtrl1 = wx.GenericDirCtrl(defaultFilter=0, dir='.', filter=u'*.htm;*.html', id=wxID_FRAME1GENERICDIRCTRL1, name='genericDirCtrl1', parent=self, pos=wx.Point(584, 8), size=wx.Size(256, 384), style=wx.DIRCTRL_3D_INTERNAL | wx.SUNKEN_BORDER) self.genericDirCtrl1.Bind(wx.EVT_LEFT_DCLICK, self.OnGenericDirCtrl1LeftDclick) def __init__(self, parent): self._init_ctrls(parent) def OnButton1Button(self, event): filex=self.genericDirCtrl1.GetPath() self.htmlWindow1.LoadFile(filex) Probajte ovaj primer... usavrsite ga... |