Below is code for a little informational dialog that I would like to
contain a throbber. The dialog displays fine, updates fine (note it is
shown as non-modal), and a nice square gray patch displays where the
throbber should be. But the throbber images don't appear. Any clues will
be appreciated.
from wxPython.lib.throbber import Throbber
import throbImages
throbber_Images = [throbImages.catalog[i].getBitmap()
for i in throbImages.index
if i not in ['eclouds', 'logo']]
class InfoDialog(wxDialog):
def __init__(self, parent, id, title, size, style):
wxDialog.__init__(self, parent, id, title, size = size, style =
style)
self.SetBackgroundColour(props.BKE_LIGHT_YELLOW)
props.SetBKE_ICON(self)
self.sizer = wxBoxSizer( wxVERTICAL )
self.throbber = Throbber(self, -1,
throbber_Images, size=(36, 36),
frameDelay = 0.1)
self.sizer.Add(self.throbber, 0, wxALIGN_CENTER)
self.throbber.Start()
# self.msg is just a placeholder since it gets replaced on update
self.msg = wxStaticText( self, -1, "")
self.sizer.AddWindow( self.msg, 0,
wxGROW>wxALIGN_CENTER_VERTICAL|wxALL, 5 )
self.SetAutoLayout( true )
self.SetSizer( self.sizer )
self.sizer.Fit( self )
self.sizer.SetSizeHints( self )
def update(self, msg):
# Replace the text to be displayed, re-layout, and update
self.SetForegroundColour(wxRED)
self.sizer.Remove(self.msg)
self.msg = wxStaticText(self, -1, msg)
self.msg.SetFont( wxFont( 10, wxSWISS, wxNORMAL, wxBOLD ) )
self.sizer.AddWindow(self.msg, 0,
wxGROW>wxALIGN_CENTER_VERTICAL|wxALL, 5 )
self.Layout()
self.sizer.Fit( self )
self.sizer.SetSizeHints( self )
self.Update()
···
--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456