Теперь ошибки с модулем images вроде бы не возникает. Но вот файл не запускается. При отладке, если не ошибаюсь, ругается на getNewBitmap().
“”“Let's create menu.”“”
import wx
import images
class ToolbarFrame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, “Adding toolbars”, size=(300, 200))
# Panel
panel = wx.Panel(self)
panel.SetBackgroundColour(“White”)
# Creating the status bar
statusBar = self.CreateStatusBar()
# Creating the toolbar
toolbar = self.CreateToolBar()
# Adding a tool to the bar
toolbar.AddSimpleTool(wx.NewId(), images.getNewBitmap(), “New”, “Long help for ‘New’”)
# Preparing the toolbar for display
toolbar.Realize()
# Creating a menubar
menuBar = wx.MenuBar()
# Creating two individual menus
menu1 = wx.Menu()
menuBar.Append(menu1, “&File”)
#menu2 = wx.Menu()
# Creating individual menu items
# Attaching the menu to the menubar
# Attaching the menubar to the frame
self.SetMenuBar(menuBar)
if __name__ == “__main__”:
app = wx.PySimpleApp()
frame = ToolbarFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()
Ошибка:
Traceback (most recent call last):
File "I:\Documents and Settings\Aleksey\My Documents\aleksej\python\wxPython\learn\5.pyw", line 36, in <module>
frame = ToolbarFrame(parent=None, id=-1)
File "I:\Documents and Settings\Aleksey\My Documents\aleksej\python\wxPython\learn\5.pyw", line 18, in __init__
toolbar.AddSimpleTool(wx.NewId(), images.getNewBitmap(), "New", "Long help for 'New'")
AttributeError: 'module' object has no attribute 'getNewBitmap'