1

I've got a small wxPython program (Python version 2.7, wxPython 2.8) up and running, but it doesn't display anything but a gray screen and a small portion of one of the buttons in the upper left corner.

I had the same problem the other day and I found that it was because I had run self.SetSizer() instead of self.panel.SetSizer(). But now it's happening even though I've made sure to avoid making that mistake this time. What am I missing here?

http://bpaste.net/show/Vq02tHA85pPi3Fm6aUtI/ <--code here

2 Answers 2

1

The problem is a parenting issue. You need to make all the widgets children of the panel. The panel should be the ONLY child of the frame. In your case, you made the panel AND the mediaCtrl widget children of the frame. If you change your media control instantiation to the following, it should work:

self.media_control = wx.media.MediaCtrl(self.apanel, style=wx.SIMPLE_BORDER, szBackend=wx.media.MEDIABACKEND_DIRECTSHOW) 

Note that the MediaCtrl is invisible. You'll probably have to add it to the sizer to make it work completely correctly.

Sign up to request clarification or add additional context in comments.

Comments

0

try set absolute:

self.apanel = wx.Panel(self, -1, size=(640, 480)) 

or use function GetBestSize()

self.apanel = wx.Panel(self, -1, size=self.GetBestSize()) 

I run successfully in py27

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.