13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating custom widgetshttp://www.zetcode.com/wxpython/customwidgets/def OnSize(self, event):self.Refresh()Every time the window is resized, we refresh the widget. This causes thewidget to repaint itself.def OnScroll(self, event):self.cw = self.sld.GetValue()self.wid.Refresh()If we scroll the thumb of the slider, we get the actual value and save itinto the self.cw parameter. This value is used, when the burning widgetis drawn. <strong>The</strong>n we cause the widget to be redrawn.Figure: Burning widget<strong>The</strong> CPU widget<strong>The</strong>re are system applications that measure system resources. <strong>The</strong>temperature, memory and CPU consuption etc. By displaying a simpletext like CPU 54% you probably won't impress your users. Specializedwidgets are created to make the application more appealing.<strong>The</strong> following widget is often used in system applications.Remark for windows users. To avoid flicker, use double buffering.Change the size of the application and the width of the slider.6 de 9 27/04/2008 1:07

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

Saved successfully!

Ooh no, something went wrong!