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.

Creating custom widgetshttp://www.zetcode.com/wxpython/customwidgets/widget. <strong>The</strong>n we modify it a bit to make a hyperlink out of this text. Wechange the font and the colour of the text. Hyperlinks are usually blue.if event.Moving():self.SetCursor(wx.StockCursor(wx.CURSOR_HAND))self.SetFont(self.font1)If we hover a mouse pointer over the link, we change the font tounderlined and also change the mouse pointer to a hand cursor.elif event.LeftUp():webbrowser.open_new(self.url)If we left click on the link, we open the link in a defaul browser.Figure: A Hyperlink widgetBurning widgetThis is an example of a widget, that we create from a ground up. We puta wx.Panel on the bottom of the window and draw the entire widgetmanually. If you have ever burned a cd or a dvd, you already saw thiskind of widget.Remark for windows users. To avoid flicker, use double buffering.#!/usr/bin/python# burning.pyimport wx3 de 9 27/04/2008 1:07

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

Saved successfully!

Ooh no, something went wrong!