X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/13baae2c95ae2e0eb01736b7d1fac6be4a2e6a3f..b7c75283f2144469e8fa6a24ca285b42fab69a6b:/wxPython/demo/ActiveX_FlashWindow.py?ds=sidebyside diff --git a/wxPython/demo/ActiveX_FlashWindow.py b/wxPython/demo/ActiveX_FlashWindow.py new file mode 100644 index 0000000000..f0cf3db966 --- /dev/null +++ b/wxPython/demo/ActiveX_FlashWindow.py @@ -0,0 +1,104 @@ +import os +import wx + +if wx.Platform == '__WXMSW__': + from wx.lib.flashwin import FlashWindow + +from Main import opj + +#---------------------------------------------------------------------- + +class TestPanel(wx.Panel): + def __init__(self, parent, log): + wx.Panel.__init__(self, parent, -1) + self.pdf = None + + sizer = wx.BoxSizer(wx.VERTICAL) + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + + self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER) + self.flash.LoadMovie(0, 'file://' + os.path.abspath('data/Asteroid_blaster.swf')) + + sizer.Add(self.flash, proportion=1, flag=wx.EXPAND) + + btn = wx.Button(self, wx.NewId(), "Open Flash File") + self.Bind(wx.EVT_BUTTON, self.OnOpenFileButton, btn) + btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5) + + btn = wx.Button(self, wx.NewId(), "Open Flash URL") + self.Bind(wx.EVT_BUTTON, self.OnOpenURLButton, btn) + btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5) + + btnSizer.Add((50,-1), proportion=2, flag=wx.EXPAND) + sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND) + + self.SetSizer(sizer) + self.SetAutoLayout(True) + + + + def OnOpenFileButton(self, event): + dlg = wx.FileDialog(self, wildcard="*.swf") + + if dlg.ShowModal() == wx.ID_OK: + wx.BeginBusyCursor() + self.flash.LoadMovie(0, 'file://' + dlg.GetPath()) + wx.EndBusyCursor() + + dlg.Destroy() + + + def OnOpenURLButton(self, event): + dlg = wx.TextEntryDialog(self, "Enter a URL of a .swf file", "Enter URL") + + if dlg.ShowModal() == wx.ID_OK: + wx.BeginBusyCursor() + # setting the movie property works too + self.flash.movie = dlg.GetValue() + wx.EndBusyCursor() + + dlg.Destroy() + + + +#---------------------------------------------------------------------- + +def runTest(frame, nb, log): + if wx.Platform == '__WXMSW__': + win = TestPanel(nb, log) + return win + else: + dlg = wx.MessageDialog(frame, 'This demo only works on MSW.', + 'Sorry', wx.OK | wx.ICON_INFORMATION) + dlg.ShowModal() + dlg.Destroy() + + +overview = """\
+Using this class is simpler than ActiveXWrapper, doesn't rely on +the win32all extensions, and is more "wx\'ish", meaning that it uses +events and etc. as would be expected from any other wx window. + +
This demo embeds the Shackwave Flash control, and lets you play a game. + + +""" + +#---------------------------------------------------------------------- + + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) + +