python类EVT_BUTTON的实例源码

Gui.py 文件源码 项目:Crypter 作者: sithis993 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def set_events(self):
        '''
        @summary: Set GUI events for the various controls
        '''

        # Catch Language choice changes
        self.Bind(wx.EVT_CHOICE, self.update_language, self.BuilderLanguageChoice)

        # Catch config file load and save
        self.Bind(wx.EVT_FILEPICKER_CHANGED, self.__load_config, self.LoadFilePicker)
        self.Bind(wx.EVT_FILEPICKER_CHANGED, self.__save_config, self.SaveFilePicker)

        # BUILD button
        self.Bind(wx.EVT_BUTTON, self.__start_build, self.BuildButton)

        # Mainframe close
        self.Bind(wx.EVT_CLOSE, self.__close_builder, self)

        # Disable Open Containing Folder Button and bind event
        self.OpenContainingFolderButton.Disable()
        self.Bind(wx.EVT_BUTTON, self.__open_containing_folder, self.OpenContainingFolderButton)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def InitUI(self):
        #draw the pannel
        wx.StaticText(self,  label='Select elements to download to local storage', pos=(30, 5))
        self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,30))
        self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,55))
        self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,80))
        self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,105))
        self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,130))
        #right side
        self.cb_all = wx.CheckBox(self, label='Back up\nWhole Pigrow Folder',pos = (270,75))
        #progress bar
        wx.StaticText(self,  label='saving to; '+ localfiles_info_pnl.local_path, pos=(15, 155))
        self.current_file_txt = wx.StaticText(self,  label='--', pos=(30, 190))
        self.current_dest_txt = wx.StaticText(self,  label='--', pos=(30, 215))
        #buttons
        self.start_download_btn = wx.Button(self, label='Download files', pos=(40, 240), size=(175, 50))
        self.start_download_btn.Bind(wx.EVT_BUTTON, self.start_download_click)
        self.close_btn = wx.Button(self, label='Close', pos=(415, 240), size=(175, 50))
        self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose)
         ## universal controls
        pnl = wx.Panel(self)
wxPython_Wallpaper.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        imageFile = 'Tile.bmp'
        self.bmp = wx.Bitmap(imageFile)
        # react to a resize event and redraw image
        parent.Bind(wx.EVT_SIZE, self.canvasCallback)

        menu = wx.Menu()
        menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
        menu.AppendSeparator()
        menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
        menuBar = wx.MenuBar()
        menuBar.Append(menu, "File") 
        parent.SetMenuBar(menuBar)  

        self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)

        button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
        self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)  

        parent.CreateStatusBar()
wxPython_OpenGL_GUI.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        menu = wx.Menu()
        menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
        menu.AppendSeparator()
        menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
        menuBar = wx.MenuBar()
        menuBar.Append(menu, "File") 
        parent.SetMenuBar(menuBar)  

        self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)

        button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
        self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)  

        parent.CreateStatusBar()
import_OpenGL_cube_and_cone.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        box = wx.BoxSizer(wx.VERTICAL)
        box.Add((20, 30))
        keys = buttonDefs.keys()

        for k in keys:
            text = buttonDefs[k][1]
            btn = wx.Button(self, k, text)
            box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 15)
            self.Bind(wx.EVT_BUTTON, self.OnButton, btn)

        # put a GLCanvas on the wx.Panel
        c = CubeCanvas(self)
        c.SetMinSize((200, 200))
        box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15)

        c = ConeCanvas(self)
        c.SetMinSize((200, 200))
        box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15)


        self.SetAutoLayout(True)
        self.SetSizer(box)
wxnsc.py 文件源码 项目:SameKeyProxy 作者: xzhou 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _bindEvents(self):
      """
      Binding events to the gui widgets.
      """
      wx.EVT_BUTTON(self, self.buttonPing.GetId(), self.OnPing)
      wx.EVT_BUTTON(self, self.buttonUpdate.GetId(), self.OnUpdate)
      wx.EVT_BUTTON(self, self.buttonClose.GetId(), self.OnClose)
      wx.EVT_BUTTON(self, self.buttonDeleteGroup.GetId(), self.OnDeleteGroup)
      wx.EVT_BUTTON(self, self.buttonCreateGroup.GetId(), self.OnCreateGroup)
      wx.EVT_BUTTON(self, self.buttonDeleteSelected.GetId(), self.OnDelete)
      wx.EVT_BUTTON(self, self.buttonRegisterItem.GetId(), self.OnRegisterItem)
      wx.EVT_BUTTON(self, self.buttonShowMeta.GetId(), self.OnShowMeta)
      wx.EVT_BUTTON(self, self.buttonSetMeta.GetId(), self.OnSetMeta)
      wx.EVT_TEXT_ENTER(self, self.txtCtrlNSHost.GetId(), self.OnCheckNS)
      wx.EVT_TEXT_ENTER(self, self.txtCtrlNSPort.GetId(), self.OnCheckNS)
      wx.EVT_CHAR(self.treeCtrlItems, self.OnKeyPressed)
url?????v1.0.py 文件源码 项目:Url 作者: beiruan 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, parent,nbresult,lf,rt):
        wx.Panel.__init__(self, parent, -1)
        panel = wx.Panel(self, -1) 
        self.nbResult = nbresult
        self.lf = lf
        self.rt = rt

        hbox1 = wx.BoxSizer(wx.HORIZONTAL)     
        self.UrlTxtCtrl = wx.TextCtrl(self, -1, "http://news.china.com.cn", style = wx.TE_PROCESS_ENTER)        
        btnStart = wx.Button(self, -1, "?", (20,20))

        #¼
        #Onstart = frame.OnStart
        self.Bind(wx.EVT_BUTTON, self.OnStart, btnStart)  
        hbox1.Add(self.UrlTxtCtrl, 1, wx.EXPAND)
        hbox1.Add(btnStart,0, wx.EXPAND)
        self.SetSizer(hbox1)
url?????v1.0.py 文件源码 项目:Url 作者: beiruan 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent,start):
        wx.Panel.__init__(self, parent, -1)
        self.start = start
        panel = wx.Panel(self, -1) 
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.NumTxtCtrl = wx.TextCtrl(self, -1, " ?v0.1.4", style = wx.TE_PROCESS_ENTER|wx.TE_READONLY)

        self.severule = wx.Button(self, -1, "" ,(20,20))
        self.btnClear = wx.Button(self, -1, "?" ,(20,20))
        self.btnParseURL = wx.Button(self, -1, "URL" ,(20,20))
        self.btnParseContent = wx.Button(self, -1, "?" ,(20,20))  

        #sizer
        hbox2.Add(self.NumTxtCtrl,1, wx.EXPAND)
        hbox2.Add(self.severule,0, wx.EXPAND)
        hbox2.Add(self.btnClear,0, wx.EXPAND)
        hbox2.Add(self.btnParseURL,0, wx.EXPAND)
        hbox2.Add(self.btnParseContent,0, wx.EXPAND)
        self.SetSizer(hbox2)
        ##?¼
        self.Bind(wx.EVT_BUTTON,  self.start.OnRemoveCache, self.btnClear)
        self.Bind(wx.EVT_BUTTON,  self.start.OnSeveResult, self.severule)
        self.Bind(wx.EVT_BUTTON,  self.start.OnStart, self.btnParseURL)
        self.Bind(wx.EVT_BUTTON,  self.start.OnStart, self.btnParseContent)
SettingsDialog.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent=None, first_run=False):
        wx.Dialog.__init__(self, parent, title="Settings", style=wx.DEFAULT_DIALOG_STYLE)
        self._first_run = first_run
        self._sizer = wx.BoxSizer(wx.VERTICAL)
        self._defaults = {}

        self._sizer.Add(URLEntryPanel(self, default_url=read_config_option("baseurl")), flag=wx.EXPAND | wx.ALL, border=5)

        authorization_sizer = wx.BoxSizer(wx.HORIZONTAL)
        authorization_sizer.Add(ClientDetailsPanel(self, default_client_id=read_config_option("client_id"), default_client_secret=read_config_option("client_secret")), flag=wx.EXPAND | wx.RIGHT, border=2, proportion=1)
        authorization_sizer.Add(UserDetailsPanel(self, default_user=read_config_option("username"), default_pass=read_config_option("password")), flag=wx.EXPAND | wx.LEFT, border=2, proportion=1)
        self._sizer.Add(authorization_sizer, flag=wx.EXPAND | wx.ALL, border=5)

        self._sizer.Add(PostProcessingTaskPanel(self, default_post_process=read_config_option("completion_cmd")), flag=wx.EXPAND | wx.ALL, border=5)
        self._sizer.Add(DefaultDirectoryPanel(self, default_directory=read_config_option("default_dir"), monitor_directory=read_config_option("monitor_default_dir", expected_type=bool)), flag=wx.EXPAND | wx.ALL, border=5)

        self._sizer.Add(self.CreateSeparatedButtonSizer(flags=wx.OK), flag=wx.EXPAND | wx.ALL, border=5)

        self.SetSizerAndFit(self._sizer)
        self.Layout()

        pub.subscribe(self._field_changed, SettingsDialog.field_changed_topic)
        self.Bind(wx.EVT_CLOSE, self._on_close)
        self.Bind(wx.EVT_BUTTON, self._on_close, id=wx.ID_OK)
        threading.Thread(target=connect_to_irida).start()
bciplayer.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def initMediaPath(self):
        mediaPathControlBox = widgets.ControlBox(self, label='Media Path', orient=wx.HORIZONTAL)

        self.mediaPathTextCtrl = wx.TextCtrl(parent=self, style=wx.TE_PROCESS_ENTER)
        self.mediaPathTextCtrl.SetValue(self.pg.defaultMusicDir)
        mediaPathControlBox.Add(self.mediaPathTextCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        self.Bind(wx.EVT_TEXT_ENTER, self.setMediaPath, self.mediaPathTextCtrl)
        self.offlineControls += [self.mediaPathTextCtrl]

        self.mediaBrowseButton = wx.Button(self, label='Browse')
        mediaPathControlBox.Add(self.mediaBrowseButton, proportion=0,
                flag=wx.TOP | wx.RIGHT | wx.BOTTOM, border=10)
        self.Bind(wx.EVT_BUTTON, self.mediaBrowse, self.mediaBrowseButton)
        self.offlineControls += [self.mediaBrowseButton]

        self.sizer.Add(mediaPathControlBox, proportion=0,
                flag=wx.ALL | wx.EXPAND, border=10)
standard.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def initStandardToolbarControls(self):
        # button to start and stop the page
        self.runButton = wx.Button(self.toolbar, label='Start')
        self.toolbar.AddControl(self.runButton, label='Run')
        self.Bind(wx.EVT_BUTTON, self.toggleRunning, self.runButton)

        # toolbar button to pause without stopping data acquisition
        self.pauseButton = wx.Button(self.toolbar, label='Pause')
        self.pauseButton.Disable()
        self.toolbar.AddControl(self.pauseButton, label='Pause')
        self.Bind(wx.EVT_BUTTON, self.togglePause, self.pauseButton)

        # toolbar button to start and stop EEG recording
        self.recordButton = wx.Button(self.toolbar, label='Start Recording')
        self.recordButton.Disable()
        self.toolbar.AddControl(self.recordButton, label='Record EEG')
        self.Bind(wx.EVT_BUTTON, self.toggleRecord, self.recordButton)

        # toolbar button to save an image of the current plot
        self.captureButton = wx.Button(self.toolbar, label='Capture Image')
        self.toolbar.AddControl(self.captureButton, label='Capture Image')
        self.Bind(wx.EVT_BUTTON, self.captureImage, self.captureButton)

        # init toolbar controls in base class
        StandardPage.initStandardToolbarControls(self)
standard.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def initStandardToolbarControls(self):
        # button to start training process
        self.trainButton = wx.Button(self.toolbar, label='Train')
        self.toolbar.AddControl(self.trainButton, label='Train')
        self.Bind(wx.EVT_BUTTON, self.toggleTrain, self.trainButton)

        # button to re-train classifier
        self.retrainButton = wx.Button(self.toolbar, label='Retrain')
        self.retrainButton.Disable()
        self.toolbar.AddControl(self.retrainButton, label='Retrain')
        self.Bind(wx.EVT_BUTTON, self.retrain, self.retrainButton)

        # button to start and stop the interface
        self.testButton = wx.Button(self.toolbar, label='Test')
        self.testButton.Disable()
        self.toolbar.AddControl(self.testButton, label='Test')
        self.Bind(wx.EVT_BUTTON, self.toggleTest, self.testButton)

        # init toolbar controls in base class
        StandardPage.initStandardToolbarControls(self)
FloatCanvasDemo.py 文件源码 项目:dxf2gcode 作者: cnc-club 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent, log):
                self.log = log
                wx.Panel.__init__(self, parent, -1)
                note1 = wx.StaticText(self, -1, "The FloatCanvas Demo needs")
                note2 = wx.StaticText(self, -1, "a separate frame")
                b = wx.Button(self, -1, "Open Demo Frame Now")
                b.Bind(wx.EVT_BUTTON, self.OnButton)

                S = wx.BoxSizer(wx.VERTICAL)
                S.Add((10, 10), 1)
                S.Add(note1, 0, wx.ALIGN_CENTER)
                S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5)
                S.Add(b, 0, wx.ALIGN_CENTER | wx.ALL, 5)
                S.Add((10, 10), 1)
                self.SetSizer(S)
                self.Layout()
LogicalVolumeDialog.py 文件源码 项目:PancakeViewer 作者: forensicmatt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwds):
        # begin wxGlade: LogicalVolumeDialog.__init__
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel_1 = wx.Panel(self, wx.ID_ANY)
        self.panel_4 = wx.Panel(self, wx.ID_ANY)
        self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Select Logical Volume: "), style=wx.ALIGN_CENTER_HORIZONTAL)
        self.panel_7 = wx.Panel(self, wx.ID_ANY)
        self.combo_logical_volumes = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
        self.panel_8 = wx.Panel(self, wx.ID_ANY)
        self.panel_3 = wx.Panel(self, wx.ID_ANY)
        self.panel_5 = wx.Panel(self, wx.ID_ANY)
        self.button_select = wx.Button(self, wx.ID_OK, _("Select"))
        self.panel_9 = wx.Panel(self, wx.ID_ANY)
        self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
        self.panel_6 = wx.Panel(self, wx.ID_ANY)
        self.panel_2 = wx.Panel(self, wx.ID_ANY)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.button_select_click, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.button_cancel_click, id=wx.ID_CANCEL)
        # end wxGlade

        self.PopulateVolumes()
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__( self, parent ):
        win_height = parent.GetSize()[1]
        height_of_pannels_above = 230
        space_left = win_height - height_of_pannels_above
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL )
        # Start drawing the UI elements
        wx.StaticText(self,  label='Pigrow Config', pos=(25, 10))
        self.update_config_btn = wx.Button(self, label='read config from pigrow', pos=(15, 60), size=(175, 30))
        self.update_config_btn.Bind(wx.EVT_BUTTON, self.update_config_click)
        self.name_box_btn = wx.Button(self, label='change box name', pos=(15, 95), size=(175, 30))
        self.name_box_btn.Bind(wx.EVT_BUTTON, self.name_box_click)
        self.config_lamp_btn = wx.Button(self, label='config lamp', pos=(15, 130), size=(175, 30))
        self.config_lamp_btn.Bind(wx.EVT_BUTTON, self.config_lamp_click)
        self.config_dht_btn = wx.Button(self, label='config dht', pos=(15, 165), size=(175, 30))
        self.config_dht_btn.Bind(wx.EVT_BUTTON, self.config_dht_click)
        self.new_gpio_btn = wx.Button(self, label='Add new relay device', pos=(15, 200), size=(175, 30))
        self.new_gpio_btn.Bind(wx.EVT_BUTTON, self.add_new_device_relay)
        self.update_settings_btn = wx.Button(self, label='update pigrow settings', pos=(15, 235), size=(175, 30))
        self.update_settings_btn.Bind(wx.EVT_BUTTON, self.update_setting_click)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__( self, parent ):
        win_height = parent.GetSize()[1]
        height_of_pannels_above = 230
        space_left = win_height - height_of_pannels_above

        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL )
        wx.StaticText(self,  label='Cron Config Menu', pos=(25, 10))
        self.read_cron_btn = wx.Button(self, label='Read Crontab', pos=(10, 40), size=(175, 30))
        self.read_cron_btn.Bind(wx.EVT_BUTTON, self.read_cron_click)
        self.new_cron_btn = wx.Button(self, label='New cron job', pos=(10, 80), size=(175, 30))
        self.new_cron_btn.Bind(wx.EVT_BUTTON, self.new_cron_click)
        self.update_cron_btn = wx.Button(self, label='Update Cron', pos=(10, 120), size=(175, 30))
        self.update_cron_btn.Bind(wx.EVT_BUTTON, self.update_cron_click)
        self.SetBackgroundColour('sea green') #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS

        bSizer = wx.BoxSizer(wx.VERTICAL)
        bSizer.Add(self.read_cron_btn, 0, wx.ALL, 5)
        bSizer.Add(self.new_cron_btn, 0, wx.ALL, 5)
        bSizer.Add(self.update_cron_btn, 0, wx.ALL, 5)
        self.SetSizer(bSizer)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 58 收藏 0 点赞 0 评论 0
def InitUI(self):
        #draw the pannel
        wx.StaticText(self,  label='Select elements to upload from local storage to pi\n\n   ** Warning this will overwrite current pigrow files \n                          which may result in loss of data **', pos=(30, 5))
        self.cb_conf = wx.CheckBox(self, label='Config',pos = (80,90))
        self.cb_logs = wx.CheckBox(self, label='Logs',pos = (80,115))
        self.cb_cron = wx.CheckBox(self, label='Crontab',pos = (80,140))
        self.cb_pics = wx.CheckBox(self, label='Photos',pos = (80,165))
        self.cb_graph = wx.CheckBox(self, label='Graphs',pos = (80,190))
        #right side
        self.cb_all = wx.CheckBox(self, label='Restore Back up\nof whole Pigrow Folder',pos = (270,130))
        #progress bar
        wx.StaticText(self,  label='uploading from; '+ localfiles_info_pnl.local_path, pos=(15, 215))
        self.current_file_txt = wx.StaticText(self,  label='--', pos=(30, 245))
        self.current_dest_txt = wx.StaticText(self,  label='--', pos=(30, 270))
        #buttons
        self.start_upload_btn = wx.Button(self, label='Upload files', pos=(40, 300), size=(175, 50))
        self.start_upload_btn.Bind(wx.EVT_BUTTON, self.start_upload_click)
        self.close_btn = wx.Button(self, label='Close', pos=(415, 300), size=(175, 50))
        self.close_btn.Bind(wx.EVT_BUTTON, self.OnClose)
         ## universal controls
        pnl = wx.Panel(self)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__( self, parent ):
        wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0,0), size = wx.Size( 285,190 ), style = wx.TAB_TRAVERSAL )
        self.SetBackgroundColour((150,230,170)) #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS
        pi_link_pnl.target_ip = ''
        pi_link_pnl.target_user = ''
        pi_link_pnl.target_pass = ''
        pi_link_pnl.config_location_on_pi = '/home/pi/Pigrow/config/pigrow_config.txt'
     ## the three boxes for pi's connection details, IP, Username and Password
        self.l_ip = wx.StaticText(self,  label='address', pos=(10, 20))
        self.tb_ip = wx.TextCtrl(self, pos=(125, 25), size=(150, 25))
        self.tb_ip.SetValue("192.168.1.")
        self.l_user = wx.StaticText(self,  label='Username', pos=(10, 60))
        self.tb_user = wx.TextCtrl(self, pos=(125, 60), size=(150, 25))
        self.tb_user.SetValue("pi")
        self.l_pass = wx.StaticText(self,  label='Password', pos=(10, 95))
        self.tb_pass = wx.TextCtrl(self, pos=(125, 95), size=(150, 25))
        self.tb_pass.SetValue("raspberry")
     ## link with pi button
        self.link_with_pi_btn = wx.Button(self, label='Link to Pi', pos=(10, 125), size=(175, 30))
        self.link_with_pi_btn.Bind(wx.EVT_BUTTON, self.link_with_pi_btn_click)
        self.link_status_text = wx.StaticText(self,  label='-- no link --', pos=(25, 160))
     ## seek next pi button
        self.seek_for_pigrows_btn = wx.Button(self, label='Seek next', pos=(190,125))
        self.seek_for_pigrows_btn.Bind(wx.EVT_BUTTON, self.seek_for_pigrows_click)
gui.py 文件源码 项目:Cosplay2-Automation 作者: Himura2la 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def on_c2_info(self, e):
        self.menu_c2_info.Enable(False)
        self.grid.ClearGrid()
        self.grid_set_shape(2, 2, 100)
        self.grid.SetColSize(1, 200)
        self.grid.SetCellValue(0, 0, "Event Name")
        self.grid.SetCellValue(1, 0, "Org Login")
        self.grid_column_readonly(0)

        if not self.read_c2_info():
            self.c2_info = ["", ""]

        self.grid.SetCellValue(0, 1, self.c2_info[0])
        self.grid.SetCellValue(1, 1, self.c2_info[1])

        apply_button = wx.Button(self, wx.ID_APPLY)
        self.Bind(wx.EVT_BUTTON, self.on_c2_info_apply, apply_button)
        self.actions_panel.Add(apply_button, 1)
        self.Layout()
AboutDialog.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def __init__(self, parent, info):
        wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        if parent and parent.GetIcon():
            self.SetIcon(parent.GetIcon())

        self.SetMinSize((400, 300))
        close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close"))

        ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)
        ctrl.SetValue(info.License)

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(close)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10)
        sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10)
        self.SetSizer(sizer)
        self.Layout()
        self.Show()
        self.SetEscapeId(close.GetId())

        close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
ProjectDialog.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, enable_required=True):
        wx.Dialog.__init__(self, parent, title=_('Project properties'),
                           style=wx.DEFAULT_DIALOG_STYLE)

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        self.ProjectProperties = ProjectPropertiesPanel(
            self,
            enable_required=enable_required)

        main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW)

        self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK,
                  self.ButtonSizer.GetAffirmativeButton())
        main_sizer.AddSizer(self.ButtonSizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)
        self.ProjectProperties.Fit()
        self.Fit()
CustomEditableListBox.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        wx.gizmos.EditableListBox.__init__(self, *args, **kwargs)

        listbox = self.GetListCtrl()
        listbox.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        listbox.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnLabelBeginEdit)
        listbox.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnLabelEndEdit)

        for button, tooltip, call_function in [
                (self.GetEditButton(), _("Edit item"), "_OnEditButton"),
                (self.GetNewButton(), _("New item"), "_OnNewButton"),
                (self.GetDelButton(), _("Delete item"), "_OnDelButton"),
                (self.GetUpButton(), _("Move up"), "_OnUpButton"),
                (self.GetDownButton(), _("Move down"), "_OnDownButton")]:
            button.SetToolTipString(tooltip)
            button.Bind(wx.EVT_BUTTON, self.GetButtonPressedFunction(call_function))

        self.Editing = False
CustomEditableListBox.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def OnKeyDown(self, event):
        button = None
        keycode = event.GetKeyCode()
        if keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD):
            button = self.GetNewButton()
        elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
            button = self.GetDelButton()
        elif keycode == wx.WXK_UP and event.ShiftDown():
            button = self.GetUpButton()
        elif keycode == wx.WXK_DOWN and event.ShiftDown():
            button = self.GetDownButton()
        elif keycode == wx.WXK_SPACE:
            button = self.GetEditButton()
        if button is not None and button.IsEnabled():
            button.ProcessEvent(wx.CommandEvent(wx.EVT_BUTTON.typeId, button.GetId()))
        else:
            event.Skip()
SearchResultPanel.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _init_ctrls(self, prnt):
        wx.Panel.__init__(self, id=ID_SEARCHRESULTPANEL,
                          name='SearchResultPanel', parent=prnt, pos=wx.Point(0, 0),
                          size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)

        self.HeaderLabel = wx.StaticText(id=ID_SEARCHRESULTPANELHEADERLABEL,
                                         name='HeaderLabel', parent=self,
                                         pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)

        search_results_tree_style = CT.TR_HAS_BUTTONS | CT.TR_NO_LINES | CT.TR_HAS_VARIABLE_ROW_HEIGHT
        self.SearchResultsTree = CT.CustomTreeCtrl(id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE,
                                                   name="SearchResultsTree", parent=self,
                                                   pos=wx.Point(0, 0), style=search_results_tree_style)
        if wx.VERSION >= (2, 8, 11):
            self.SearchResultsTree.SetAGWWindowStyleFlag(search_results_tree_style)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnSearchResultsTreeItemActivated,
                  id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE)

        self.ResetButton = wx.lib.buttons.GenBitmapButton(
            self, bitmap=GetBitmap("reset"),
            size=wx.Size(28, 28), style=wx.NO_BORDER)
        self.ResetButton.SetToolTipString(_("Reset search result"))
        self.Bind(wx.EVT_BUTTON, self.OnResetButton, self.ResetButton)

        self._init_sizers()
DurationCellEditor.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        wx.Control.__init__(self, parent)

        main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        # create location text control
        self.Duration = wx.TextCtrl(self, size=wx.Size(0, -1),
                                    style=wx.TE_PROCESS_ENTER)
        self.Duration.Bind(wx.EVT_KEY_DOWN, self.OnDurationChar)
        main_sizer.AddWindow(self.Duration, flag=wx.GROW)

        # create browse button
        self.EditButton = wx.Button(self, label='...', size=wx.Size(30, -1))
        self.Bind(wx.EVT_BUTTON, self.OnEditButtonClick, self.EditButton)
        main_sizer.AddWindow(self.EditButton, flag=wx.GROW)

        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.SetSizer(main_sizer)

        self.Default = None
drillP68-dbftGui.py 文件源码 项目:Portfolio 作者: rebeccapizano 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY,
                          "File and Folder Dialogs Tutorial")
        panel = wx.Panel(self, wx.ID_ANY)
        self.currentDirectory = os.getcwd()

        # create the buttons and bindings
        dirDlgBtn1 = wx.Button(panel, label="Choose Source")
        dirDlgBtn1.Bind(wx.EVT_BUTTON, self.onDir1)

        dirDlgBtn2 = wx.Button(panel, label="Choose Destination")
        dirDlgBtn2.Bind(wx.EVT_BUTTON, self.onDir2)

        moveBtn=wx.Button(panel, label="Check and Move Files")
        moveBtn.Bind(wx.EVT_BUTTON, self.moveUFiles) 

        # put the buttons in a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(dirDlgBtn1, 0, wx.ALL|wx.CENTER, 5)
        sizer.Add(dirDlgBtn2, 0, wx.ALL|wx.CENTER, 5)
        sizer.Add(moveBtn, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)
lib.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        # begin wxGlade: CE_TE.__init__
        #kwds["style"] = wx.CLOSE_BOX|wx.MINIMIZE_BOX
        wx.Dialog.__init__(self, parent,id=-1,title="CE and TE")
        self.parent=parent
        self.label_1 = wx.StaticText(self, -1, "Max_CE")
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
        self.label_2 = wx.StaticText(self, -1, "Max_TE")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "OK")
        self.button_2 = wx.Button(self, -1, "Cancel")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_1)
        self.Bind(wx.EVT_TEXT, self.On_CE_Text, self.text_ctrl_1)
        self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_2)
        self.Bind(wx.EVT_TEXT, self.On_TE_Text, self.text_ctrl_2)
        self.Bind(wx.EVT_BUTTON, self.On_Ok, self.button_1)
        self.Bind(wx.EVT_BUTTON, self.On_Cancel, self.button_2)
        # end wxGlade
login_OLD.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 44 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwds):
        # begin wxGlade: secret_win.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.label_1 = wx.StaticText(self, -1, "School Name")
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
        self.label_2 = wx.StaticText(self, -1, "School Code")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "Save")
        self.DB=db_operations()
        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_save, self.button_1)
        self.on_load()
        self.Center()
        # end wxGlade
disclaimer.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwds):
        # begin wxGlade: disclaimer_win.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_1 = wx.StaticText(self, wx.ID_ANY, ("Disclaimer"))
        self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP)
        self.button_disagree = wx.Button(self, wx.ID_ANY, ("Disagree"))
        self.button_agree = wx.Button(self, wx.ID_ANY, ("I agree"))
        self.text='''


This SOFTWARE PRODUCT is a an open source free software distributed with GPL 3 License. Your are free to modify it subject to the
conditions laid in the license. It is also stated that the software is provided  "as is" and "with all faults." 
THE developer makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. 
There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and and suits your needs. 
You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT.'''
        self.__set_properties()
        self.__do_layout()
        self.agree=False


        self.Bind(wx.EVT_BUTTON, self.on_disagree, self.button_disagree)
        self.Bind(wx.EVT_BUTTON, self.on_agree, self.button_agree)
        # end wxGlade
login.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwds):
        # begin wxGlade: secret_win.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.label_1 = wx.StaticText(self, -1, "School Name")
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
        self.label_2 = wx.StaticText(self, -1, "School Code")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "Save")
        self.DB=db_operations()
        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.on_save, self.button_1)
        self.on_load()
        self.Center()
        # end wxGlade


问题


面经


文章

微信
公众号

扫码关注公众号