Skip to content

Instantly share code, notes, and snippets.

@driscollis
Created July 2, 2014 21:00
Show Gist options
  • Save driscollis/0125765cacbc761e9fe8 to your computer and use it in GitHub Desktop.
Save driscollis/0125765cacbc761e9fe8 to your computer and use it in GitHub Desktop.
Centered widgets
import wx
import wx.animate
import os
import os
GIFNames = [
#os.path.join(os.path.dirname(__file__),'bitmaps', 'AG00178_.gif'),
os.path.join(os.path.dirname(__file__), "bitmaps", "Spinning_wheel_throbber.gif"),
#os.path.join(os.path.dirname(__file__),'bitmaps', 'BD13656_.gif'),
#os.path.join(os.path.dirname(__file__),'bitmaps', 'AG00185_.gif'),
#os.path.join(os.path.dirname(__file__),'bitmaps', 'AG00039_.gif'),
#s.path.join(os.path.dirname(__file__),'bitmaps', 'AG00183_.gif'),
#s.path.join(os.path.dirname(__file__),'bitmaps', 'AG00028_.gif'),
]
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
Hsizer = wx.BoxSizer(wx.HORIZONTAL)
Vsizer = wx.BoxSizer(wx.VERTICAL)
for name in GIFNames:
ctrl = wx.Button(self, label=os.path.basename(name))
Hsizer.AddF(ctrl, wx.SizerFlags(0).Center())
Vsizer.Add((10, -1), 1, wx.EXPAND)
Vsizer.AddF(Hsizer, wx.SizerFlags(0).Center())
Vsizer.Add((10, -1), 1, wx.EXPAND)
#border = wx.BoxSizer()
#border.AddF(sizer, wx.SizerFlags(1).Expand().Border(wx.ALL, 20))
self.SetSizerAndFit(Vsizer)
#----------------------------------------------------------------------
class myFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, parent=None, title="animate test", size=(800, 600))
TestPanel(self)
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>wx.animate.AnimationCtrl</center></h2>
wx.animate.AnimationCtrl is like a wx.StaticBitmap but is able to
display an animation by extracing frames from a multi-image GIF file.
</body></html>
"""
if __name__ == "__main__":
app = wx.App(False)
frame = myFrame()
frame.Show()
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment