[Python-de] Re: Problem mit Python und GUI-Toolkits
Jan Ulrich Hasecke
janulrich.hasecke at web.de
Mon Jan 3 13:58:58 CET 2005
Hallo,
danke für die schnelle Antwort.
Ich hab jetzt an diese Stelle ein print item eingefügt:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def createMenuBar(self):
self.menuBar = Menu(self)
for label, menu in self.allMenus:
popup = Menu(self.menuBar, tearoff=1)
for item in menu:
print item
if item:
both, help, icon, text, callbackname = item
callback = getattr(self.app, callbackname)
underline = text.find("&")
text=text.replace("&","")
popup.add("command",label=text,
command = callback,
underline=underline)
if both==BOTH:
self.toolBar.add(text,
self.iconPath+icon,
callback,
help)
else:
popup.add_separator()
underline = label.find("&")
label = label.replace("&","")
self.menuBar.add_cascade(label=label,
menu=popup,
underline=underline)
self.toolBar.app_separator()
self["menu"] = self.menuBar
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Wenn ich richtig zähle, sind jeweils fünf Elemente drin:
Es erscheint diese Fehlermeldung:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> ## working on region in file /tmp/python-9883UQr.py...
('both', 'Neue Datei erstellen', 'New.gif', '&Neu', 'miFileNew')
('both', 'Exestierende Datei \xc3\xb6ffnen', 'Open.gif', '&\xc3\x96ffnen', 'miFileOpen')
(0, 'Exestierende Datei schliessen', '', 'Schliessen', 'miFileClose')
None
('both', 'Aktuelle Datei speichern', 'Save.gif', '&Speichern', 'miFileSave')
(0, 'AktuelleDatei unter einem anderen Namen speichern', '', '&Speichern &unter...', 'miFileSaveAs')
None
('both', 'Aktuelle Datei ausdrucken', 'Print.gif', '&Drucken', 'miFilePrint')
None
('both', 'Eine Datei Importieren', 'DataStore.gif', '&Import...', 'miFileImport')
('both', 'Eine Datei Exportieren', 'DataExtract.gif', '&Exportieren...', 'miFileExport')
none
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/tmp/python-9883UQr.py", line 178, in ?
applikation = tkKontaktAnwendung()
File "/tmp/python-9883UQr.py", line 166, in __init__
self.mainWindow = tkHauptfenster(self)
File "/tmp/python-9883UQr.py", line 86, in __init__
self.createMenuBar()
File "/tmp/python-9883UQr.py", line 104, in createMenuBar
both, help, icon, text, callbackname = item
ValueError: need more than 4 values to unpack
juh
--
Die kommunalen Bürgerportale
Offene Nachrichten- und Diskussionsforen
http://www.buergerportal.de/