I can't get the menu or status bar to show up when executing the following program:

import wx
ID_ABOUT=101
ID_EXIT=110
class MainWindow(wx.Frame):
	def __init__(self, parent,id,title):
		wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200,100))
		self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
		self.CreateStatusBar() #A Statusbar in the bottom of the window
		#Setting up the menu.
		filemenu = wx.Menu()
		filemenu.Append(ID_ABOUT,"&About"," Information about this program")
		filemenu.AppendSeparator()
		filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
		#Creating the menubar
		menuBar = wx.MenuBar()
		menuBar.Append(filemenu,"&File") #Adding the "filemenu" to the MenuBar
		self.SetMenuBar(menuBar) #Adding the menubar to the Frame content.
		self.Show(True)
		
app = wx.PySimpleApp()
frame = MainWindow(None, -1, "Sample Editor")
app.MainLoop()

The text editor part is the only part that appears. Anybody know what the problem is? Using python 2.6.2, wxPython 2.8

Recommended Answers

All 5 Replies

I can't get the menu or status bar to show up when executing the following program:

import wx
ID_ABOUT=101
ID_EXIT=110
class MainWindow(wx.Frame):
	def __init__(self, parent,id,title):
		wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200,100))
		self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
		self.CreateStatusBar() #A Statusbar in the bottom of the window
		#Setting up the menu.
		filemenu = wx.Menu()
		filemenu.Append(ID_ABOUT,"&About"," Information about this program")
		filemenu.AppendSeparator()
		filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
		#Creating the menubar
		menuBar = wx.MenuBar()
		menuBar.Append(filemenu,"&File") #Adding the "filemenu" to the MenuBar
		self.SetMenuBar(menuBar) #Adding the menubar to the Frame content.
		self.Show(True)
		
app = wx.PySimpleApp()
frame = MainWindow(None, -1, "Sample Editor")
app.MainLoop()

The text editor part is the only part that appears. Anybody know what the problem is? Using python 2.6.2, wxPython 2.8

Works fine for me
Python 2.5.4, wxPython 2.8

Well at first glance the code looks OK....
To confirm it, I just tried your code and it works for me on Windows and Ubuntu (both have Python 2.6 and wxPython 2.8 installed)

I can see the menu, mousing over the menu items causes text to be displayed in the status bar....So the question is why are you not seeing the status bar or the menu?

I don't know what to suggest. I can't think of anything that could cause you to see anything differently....hmmm! {scratches beard..}

Works fine for me to.
Testet 2.5.4 and 2.6.2 wxPython 2.8.

thanks for testing it out. I'm using with mac 10.4 OS so I guess it has something to do with that then. It's weird because I tried a lot of the demo programs and all of them worked except for Menu.py(even the StatusBar.py worked by itself). Are the menus in mac different such that I need to handle them differently or should this be working? I followed the instructions from wxpython.org website to the letter for the mac build.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.