X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fa876ca9ec87e90605808bfcab4d4226965dbad..25b3661bd4cb44304418b93c0dee1d0dfb99765c:/wxPython/demo/Throbber.py diff --git a/wxPython/demo/Throbber.py b/wxPython/demo/Throbber.py index 1029434064..10b91c667e 100644 --- a/wxPython/demo/Throbber.py +++ b/wxPython/demo/Throbber.py @@ -1,13 +1,5 @@ -# -# Throbber.py - Cliff Wells -# -# 11/23/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o Updated for wx namespace -# import wx -import wx.lib.rcsizer as rcs import wx.lib.throbber as throb import throbImages # this was created using a modified version of img2py @@ -77,47 +69,33 @@ class TestPanel(wx.Panel): pointSize = 8, family = wx.DEFAULT, style = wx.NORMAL, weight = wx.BOLD )) - # this throbber is created using a single, composite image - self.otherThrobber = throb.Throbber( - self, -1, throbImages.catalog['eclouds'].getBitmap(), frameDelay = 0.15, - frames = 12, frameWidth = 48, label = "Stop" - ) - - - self.otherThrobber.Bind(wx.EVT_LEFT_DOWN, self.OnClickThrobber) - box = wx.BoxSizer(wx.VERTICAL) - sizer = rcs.RowColSizer() + sizer = wx.GridBagSizer() box.Add(sizer, 1, wx.EXPAND|wx.ALL, 5) sizer.AddGrowableCol(1) - sizer.Add( - self.otherThrobber, row = 0, col = 2, rowspan = 4, - flag = wx.ALIGN_CENTER_VERTICAL - ) - row = 2 # use a list so we can keep our order for t in ['plain', 'reverse', 'autoreverse', 'label', 'overlay', 'overlay+text']: sizer.Add( - self.throbbers[t]['throbber'], row = row, col = 0, + self.throbbers[t]['throbber'], (row, 0), (1, 1), flag = wx.ALIGN_CENTER|wx.ALL, border=2 ) sizer.Add( wx.StaticText(self, -1, self.throbbers[t]['text']), - row = row, col = 1, flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT + (row, 1), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT ) row += 1 # start and stop buttons startButton = wx.Button(self, -1, "Start") - self.Bind(wx.EVT_BUTTON, self.OnStartAnimation, id=startButton.GetId()) + self.Bind(wx.EVT_BUTTON, self.OnStartAnimation, startButton) stopButton = wx.Button(self, -1, "Stop") - self.Bind(wx.EVT_BUTTON, self.OnStopAnimation, id=stopButton.GetId()) + self.Bind(wx.EVT_BUTTON, self.OnStopAnimation, stopButton) buttonBox = wx.BoxSizer(wx.HORIZONTAL) buttonBox.AddMany([ @@ -125,12 +103,9 @@ class TestPanel(wx.Panel): (stopButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5), ]) - sizer.Add(buttonBox, - row = len(self.throbbers) + 3, - col = 0, - colspan = 3, - flag = wx.ALIGN_CENTER - ) + sizer.Add( + buttonBox, (len(self.throbbers) + 3, 0), (1, 3), flag = wx.ALIGN_CENTER + ) self.SetSizer(box) self.SetAutoLayout(True) @@ -141,9 +116,6 @@ class TestPanel(wx.Panel): for t in self.throbbers.keys(): self.throbbers[t]['throbber'].Start() - self.otherThrobber.Start() - self.otherThrobber.Reverse() - self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy) def OnDestroy(self, event): @@ -158,16 +130,7 @@ class TestPanel(wx.Panel): for t in self.throbbers.keys(): self.throbbers[t]['throbber'].Rest() - def OnClickThrobber(self, event): - if self.otherThrobber.Running(): - self.otherThrobber.Rest() - self.otherThrobber.SetLabel("Start") - else: - self.otherThrobber.Start() - self.otherThrobber.SetLabel("Stop") - def ShutdownDemo(self): - self.otherThrobber.Rest() for t in self.throbbers.keys(): self.throbbers[t]['throbber'].Rest() @@ -175,13 +138,8 @@ class TestPanel(wx.Panel): #---------------------------------------------------------------------- def runTest(frame, nb, log): - if wx.Platform == "__WXMAC__": - wx.MessageBox("This demo currently fails on the Mac.", - "Sorry") - return - else: - win = TestPanel(nb, log) - return win + win = TestPanel(nb, log) + return win #---------------------------------------------------------------------- @@ -198,4 +156,4 @@ overview = """ if __name__ == '__main__': import sys,os import run - run.main(['', os.path.basename(sys.argv[0])]) + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])