我是python的新手,使用wxpython做
的小型GUI项目这是我的代码: 导入wx 将wx.grid导入为gridlib
类安装(wx.Frame):
def __init__ (self):
wx.Frame.__init__(self, None, -1, 'Instal Deb', size=(250, 300), style = wx.MINIMIZE_BOX | wx.CLOSE_BOX | wx.SYSTEM_MENU)
panel = wx.Panel(self, -1)
text = wx.StaticText(panel, -1, label = 'System Name?', pos=(15,15))
basicText = wx.TextCtrl(panel, -1, " ",pos=(15,32), size=(100,-1))
basicText.SetInsertionPoint (0)
sampleList = [' ', 'abc','xyz']
wx.StaticText(panel, -1, "system Type?" , pos=(15, 70))
wx.Choice(panel, -1, (15, 85), choices=sampleList)
wx.StaticText(panel, -1, "Licence :", pos=(15,125))
self.Center()
如果名称 =='主要':
app = wx.PySimpleApp()
install().Show()
app.MainLoop()
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ < / p>
我想在“许可证”文本下添加2个选项框(例如:xx&amp; yy)。当我在系统类型选择框中选择“混合”时,两者都必须出现或保持在那里,但是当我在选择框中选择“NVR”,“YY”选项框应该消失, 因为我是新手,我无法理解怎么做。请帮我解决我的问题..
答案 0 :(得分:1)
def OnChoice1(evt):
print self.ch1.SelectedString()
self.ch2 = wx.Choice(panel,-1,(x,y),choices=["ABC".split()]
def __init__(self):
...
self.ch1 = wx.Choice(panel, -1, (15, 85), choices=sampleList)
self.ch1.Bind(wx.EVT_CHOICE,OnChoice1)
我会让你填补一些空白,但那是你需要知道的大部分空白