wxpython自己搭界面,但是event似乎不太對
import wx
import os
import CV2
class mainframe(wx.Frame):
? ? def __init__(self, parent):
? ? ? ? wx.Frame.__init__(self,parent,title='主界面',size=(1080,720))
? ? ? ? self.BeginBtn = wx.Button(self,label='開始',pos=(5,5),size=(80,25))
? ? ? ? self.BeginBtn.Bind(wx.EVT_BUTTON,self.openfile)
? ? ? ? self.inputBtn= wx.Button(self,label='輸入',pos=(105,5),size=(80,25))
? ? ? ? self.inputBtn.Bind(wx.EVT_BUTTON,self.inputmsg)
? ? ? ? self.FileName = wx.TextCtrl(self,pos=(205,5),size=(230,25))
? ? ? ??
? ? ? ??
? ? def openfile(self,event):
? ? ? ? wildcard = 'All files(*.*)|*.*'
? ? ? ? dialog = wx.FileDialog(None,'select',os.getcwd(),'',wildcard,wx.FD_OPEN) ?#####這個部分新舊版本有變化
? ? ? ? if dialog.ShowModal() == wx.ID_OK:
? ? ? ? ? ? self.FileName.SetValue(dialog.GetPath())
? ? ? ? ? ? dialog.Destroy
? ??
? ? def inputmsg(self,event): ?
? ? ? ? wx.Dialog(self, wx.ID_ANY, '管理員登陸')
? ? ? ? self.imput = wx.TextCtrl(self, -1,pos=(300,100),size=(250,30))
? ? ? ? self._layout()
? ? ? ??
? ? ? ? ? ??
? ? ? ? ? ??
if __name__=='__main__':
? ? app = wx.App()
? ? SiteFrame = mainframe(parent=None)
? ? SiteFrame.Show()
? ? app.MainLoop()