1
我正在使用的wxPython,我的代碼pecie是,我有一個類來設計一個GUI其中FRAM保存組合框的選擇值在wxPython
聲明,也是我宣佈,我想變數恰克基礎上,組合框
選擇它們的值。我做了如下因素:
class myMenu(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(900, 700))
self.ct = 0
self.phaseSelection = ""
self.opSelection = ""
self.instSelection = ""
self.orgSelection = ""
panel = wx.Panel(self, -1)
panel.SetBackgroundColour('#4f3856')
phasesList = ["preOperations", "inOperations", "postOperations"]
self.cbPhases = wx.ComboBox(panel, 500, 'Phase', (50, 150), (160,-1), phasesList, wx.CB_DROPDOWN)
self.Bind(wx.EVT_COMBOBOX, self.OnPhaseSelection, id = self.cbPhases.GetId())
,這是「OnPhaseSelection」事件的代碼:
def OnPhaseSelection(self, event):
self.phaseSelection = self.cbPhases.GetValue()
這裏我想保存在變量「self.phaseSelection」我宣佈它選擇的值與
空字符串作爲初始值,然後我想用新保存的值這個變量,但是當我運行
程序,該變量包含高清組合框的價值!所以請什麼是在
我的工作的問題?