13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>wxPython</strong> widgetshttp://www.zetcode.com/wxpython/widgets/hbox1.Add(self.gauge, 1, wx.ALIGN_CENTRE)hbox2.Add(self.btn1, 1, wx.RIGHT, 10)hbox2.Add(self.btn2, 1)hbox3.Add(self.text, 1)vbox.Add((0, 30), 0)vbox.Add(hbox1, 0, wx.ALIGN_CENTRE)vbox.Add((0, 20), 0)vbox.Add(hbox2, 1, wx.ALIGN_CENTRE)vbox.Add(hbox3, 1, wx.ALIGN_CENTRE)panel.SetSizer(vbox)self.Centre()self.Show(True)def OnOk(self, event):if self.count >= 50:returnself.timer.Start(100)self.text.SetLabel('Task in Progress')def OnStop(self, event):if self.count == 0 or self.count >= 50 or not self.timer.IsRunning():returnself.timer.Stop()self.text.SetLabel('Task Interrupted')wx.Bell()def OnTimer(self, event):self.count = self.count +1self.gauge.SetValue(self.count)if self.count == 50:self.timer.Stop()self.text.SetLabel('Task Completed')app = wx.App()Gauge(None, -1, 'gauge.py')app.MainLoop()wx.Sliderwx.Slider is a widget that has a simple handle. This handle can bepulled back and forth. This way we are choosing a value for aspecific task. Say we want to input into our application the age ofa customer. For this purpose, wx.Slider might be a good choice.wx.Slider styleswxSL_HORIZONTALwxSL_VERTICALwxSL_AUTOTICKSwxSL_LABELSwxSL_LEFTwxSL_RIGHTwxSL_TOPwxSL_BOTTOMwxSL_INVERSE17 de 29 27/04/2008 1:04

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!