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.

Advanced widgetshttp://www.zetcode.com/wxpython/advanced/Deleting an item is done in two steps. First we find the index of the selecteditem by calling the GetSelection() method. <strong>The</strong>n we delete the item with theDelete() method. <strong>The</strong> parametor to the Delete() method is the selectedindex.self.listbox.Delete(sel)self.listbox.Insert(renamed, sel)Notice, how we managed to rename a string. wx.ListBox widget has noRename() method. We did this functionality by deleting the previouslyselected string and inserting a new string into the predecessor's position.def OnClear(self, event):self.listbox.Clear()<strong>The</strong> easiest thing is to clear the whole listbox. We simply call the Clear()method.A wx.ListBox widgetA W X . H T M L . H T M L W I N D O W W I D G E T<strong>The</strong> wx.html.HtmlWindow widget displays html pages. It is not a full-fledgedbrowser. We can do interesting things with wx.html.HtmlWindow widget.Special formattingFor example in the following script we will create a window, that will displaybasic statistics. This formatting would be very hard if possible to createwithout wx.html.HtmlWindow widget.#!/usr/bin/pythonimport wximport wx.html as htmlID_CLOSE = 14 de 21 27/04/2008 1:05

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

Saved successfully!

Ooh no, something went wrong!