ich habe ein Mini-Programm welches zuerst einen kleinen Abfragedialog startet. Nachdem der Benutzer einen Text eingegeben und bestätigt hat, erscheint ein weiteres Fenster. Leider wird im zweiten Fenster nicht meine Menüleiste angezeigt. Ich habe englischsprachige Kommentare eingefügt, da ich zuerst im englischsprachigen #wxpython IRC-Channel gefragt habe. Leider konnte ich dort keine Antwort erhalten. Weis jemand wieso meine Menüleiste nicht angezeigt wird?
Code: Alles auswählen
import wx
# -*- coding: utf-8 -*-
class wxpythoninfo(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'FTitle', size=(300,200))
panel=wx.Panel(self)
# Textinput-dialogue
box=wx.TextEntryDialog(None, "Text over input field", "Windowtitle", "input anything")
# after the first window with the textfield
if box.ShowModal()==wx.ID_OK:
# the following appears
wx.Frame.__init__(self,parent,id,'Window title', size=(300,200))
panel=wx.Panel(self)
# isn't appearing begin
menubar=wx.MenuBar()
first=wx.Menu()
second=wx.Menu()
menubar.Append(first,"File")
menubar.Append(second,"Edit")
first.Append(wx.NewId(),"New window","That's a new window." )
first.Append(wx.NewId(),"Open","Opens a new window." )
self.SetMenuBar(menubar)
# isn't appearing end
if __name__=='__main__':
#inits the program
app=wx.PySimpleApp()
#shows the program
frame=wxpythoninfo(parent=None,id=-1)
frame.Show()
app.MainLoop()