Is it possible to clone a wxPanel across a pair of frames in wxPython?
- I have tried using the same wxID, which resulted in of significance.
- I have tried using the same instance of the control which results in only one being drawn.
I am ultimately trying to display the output of LibVLC (which renders to a wxPanel via it's hwnd) on two frames simultaneously. One frame is inside a control window to provide a "preview" of the video while the other is displayed fullscreen on a second monitor.
Here's a reduced version of the code I'm using to display the video output in the preview window:
class MainFrame(wx.Frame):
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.video_panel = wx.Panel(self, wx.ID_ANY)
self.video_panel.SetBackgroundColour(wx.Colour(0, 0, 0))
sizer_video = wx.BoxSizer(wx.VERTICAL)
sizer_video.Add(self.video_panel, 1, wx.ALL | wx.EXPAND, 2)
self.SetSizer(sizer_video)
self.Layout()
self.Instance = Libraries.vlc.Instance()
self.player = self.Instance.media_player_new()
def mediaLoad(self, path):
self.Media = self.Instance.media_new(unicode(path))
self.player.set_media(self.Media)
if sys.platform.startswith('win'):
self.player.set_hwnd(self.video_panel.GetHandle())
elif sys.platform.startswith('linux'):
self.player.set_xwindow(self.video_panel.GetHandle())
else:
self.player.set_nsobject(self.video_panel.GetHandle())