37,719
社区成员
发帖
与我相关
我的任务
分享
import wx
class InFrame(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id, '人机交互检索界面',
size=(800, 600))
panel = wx.Panel(self)
center = wx.StaticText(panel, -1, "常见赤潮藻藻种检索系统软件", (300, 25),
(160, -1), wx.ALIGN_CENTER)
center.SetForegroundColour('blue')
center = wx.StaticText(panel, -1,"检索结果:",(400,70),
(160,-1),wx.ALIGN_CENTER)
center.SetForegroundColour('black')
#生成下拉菜单选项
sampleList = ['不确定','单细胞', '群体',]
wx.StaticText(panel, -1, "生活形态:", (15, 70))
wx.Choice(panel, -1, (90, 68), choices=sampleList,name="LifeStyle")
sampleList = ['不确定','小', '较大','大',]
wx.StaticText(panel, -1, "细胞大小:", (15, 120))
wx.Choice(panel, -1, (90, 118), choices=sampleList,name="size")
sampleList = ['不确定','新月形', '二叉形',]
wx.StaticText(panel, -1, "细胞形态:", (15, 170))
wx.Choice(panel, -1, (90, 168), choices=sampleList,name="CellsForm")
sampleList = ['不确定', '棕黄色','黄褐色','黄绿色',]
wx.StaticText(panel, -1, "色素体颜色:", (15, 220))
wx.Choice(panel, -1, (90, 218), choices=sampleList,name="colour")
sampleList = ['不确定', '光滑','布满小刺', '前端具钩状突起',]
wx.StaticText(panel, -1, "细胞外特征:", (15, 270))
wx.Choice(panel, -1, (90, 268), choices=sampleList,name="character")
#生成“重置”“检索”按钮,并绑定鼠标单击事件,但我不知道绑定是否正确。
self.resetButton = wx.Button(panel, label="重置", pos=(13,320),
size=(60,30))
self.resetButton.Bind(wx.EVT_BUTTON, self.OnClearMe)
self.resetButton.Bind(wx.EVT_CHOICE, self.OnReset)
self.findButton = wx.Button(panel, label="检索", pos=(93, 320),
size=(60,30))
self.findButton.Bind(wx.EVT_BUTTON, self.OnFindMe)
self.findButton.Bind(wx.EVT_CHOICE, self.OnFind)
#生成“退出”按钮并绑定单击事件,形成事件。
self.button = wx.Button(panel, label="退出", pos=(715, 523),
size=(60,30))
self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
#下面是我的问题所在。
def OnClearMe(self,event):
self.Clear()#这地方程序我不会写,这样写显然不对。
def OnReset(self,event):
self.Clear()#这地方我不会写。
def OnFind(self,event):
self.Clear()#这地方我不会写,为了您能运行程序不影响其他界面按钮,
#我暂时随便用Clear()充数。
def OnFindMe(self,event):
self.Clear()#这地方我不会写,为了您能运行程序不影响其他界面按钮,
#我暂时随便用Clear()充数。
def OnCloseMe(self, event):
self.Close(True)
def OnCloseWindow(self, event):
self.Destroy()
event.Skip()
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = InFrame(parent=None, id=-1)
frame.Show()
app.MainLoop()