wxPython application completely invisible in OSX

Go To StackoverFlow.com

0

I have a Python application which uses wxPython for a GUI. It runs fine on a Windows XP machine, but I need to work on it on my Mac.

On OSX, running main.py works, and it brings up a window called "Python" (and keeps the process running in the terminal). But, where in XP the Python window has the GUI, the OSX version is totally invisible. Nothing shows at all (but the application is definitely open. Hitting enter in the "invisible window" causes the expected response in the terminal)

What might I need to add / modify to make anything actually show up on OSX? The window init code all seems OS-agnostic, except for the specified font ('MS Shell Dig 2').

2012-04-03 22:55
by Aaron Marks
Have you tried breaking down your testing to simpler steps? Try first showing an empty window (5ish lines of code) to verify results, and keep adding more until you find out what is not working. I don't think anyone is going to have a solid answer short of reviewing your code and testing it (which people probably wont do beyond a test snippet). wx should be OS agnostic - jdi 2012-04-04 00:50


1

Do you have a wx.Panel as the main child of your frame? Create a single panel in your main frame and add the rest of your controls to that panel instead of the frame itself. I recall having some problems similar to yours which were solved in this way.

Something quick to show the idea:

import wx

class MainWindow(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        self.panel = wx.Panel(self)
        # Add other controls to the main panel, not the frame
        self.text = wx.TextCtrl(self.panel) 
        self.Show()

app = wx.App(False)
win = MainWindow(None)
app.MainLoop()
2012-04-12 17:38
by NoName
Ads