欢迎光临散文网 会员登陆 & 注册

wxpython自己搭界面,但是event似乎不太对

2020-03-19 19:33 作者:一心想当网红的李老师  | 我要投稿

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()


wxpython自己搭界面,但是event似乎不太对的评论 (共 条)

分享到微博请遵守国家法律