Python wx 模块,EVT_BUTTON 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.EVT_BUTTON

项目:Crypter    作者:sithis993    | 项目源码 | 文件源码
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    作者:Pragmatismo    | 项目源码 | 文件源码
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)
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
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()
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
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()
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
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)
项目:SameKeyProxy    作者:xzhou    | 项目源码 | 文件源码
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    作者:beiruan    | 项目源码 | 文件源码
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    作者:beiruan    | 项目源码 | 文件源码
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)
项目:irida-miseq-uploader    作者:phac-nml    | 项目源码 | 文件源码
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()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
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)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
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)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
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)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
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()
项目:PancakeViewer    作者:forensicmatt    | 项目源码 | 文件源码
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    作者:Pragmatismo    | 项目源码 | 文件源码
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    作者:Pragmatismo    | 项目源码 | 文件源码
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    作者:Pragmatismo    | 项目源码 | 文件源码
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    作者:Pragmatismo    | 项目源码 | 文件源码
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)
项目:Cosplay2-Automation    作者:Himura2la    | 项目源码 | 文件源码
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()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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())
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
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
项目:Portfolio    作者:rebeccapizano    | 项目源码 | 文件源码
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)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
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
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
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
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
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
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
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
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: sms_dialoge.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.THICK_FRAME
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_5 = wx.Panel(self, wx.ID_ANY)
        self.label_7 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Username"))
        self.combo_box_1 = wx.ComboBox(self.panel_5, wx.ID_ANY, choices=[("Select"), ("admin"), ("teacher")], style=wx.CB_READONLY|wx.CB_DROPDOWN)
        self.label_8 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Password"))
        self.text_ctrl_1 = wx.TextCtrl(self.panel_5, wx.ID_ANY, "", style=wx.TE_PASSWORD)
        self.button_1 = wx.Button(self.panel_5, wx.ID_ANY, ("Cancel"))
        self.button_2 = wx.Button(self.panel_5, wx.ID_ANY, ("Login"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_user, self.combo_box_1)
        self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_1)
        self.Bind(wx.EVT_BUTTON, self.on_login, self.button_2)

        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress)
        self.Bind(wx.EVT_CLOSE,self.on_close,self)
        self.UO=user_operations(self)
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: MyDialog.__init__
        #args[
        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP
        wx.Dialog.__init__(self, *args, **kwds)
        self.text_ctrl_passwd = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD)
        self.button_cancel = wx.Button(self, wx.ID_ANY, _("Cancel"))
        self.button_ok = wx.Button(self, wx.ID_ANY, _("OK"))

        self.__set_properties()
        self.__do_layout()

        self.password_text=''
        self.Bind(wx.EVT_TEXT, self.on_passwod, self.text_ctrl_passwd)
        self.Bind(wx.EVT_BUTTON, self.on_button_cancel, self.button_cancel)
        self.Bind(wx.EVT_BUTTON, self.on_button_ok, self.button_ok)
        self.cancelled=False
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: add_academic_year.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_3 = wx.StaticText(self, wx.ID_ANY, ("Academic Year"))
        self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.label_4 = wx.StaticText(self, wx.ID_ANY, ("-"))
        self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.button_close = wx.Button(self, wx.ID_ANY, ("Close"))
        self.button_add = wx.Button(self, wx.ID_ANY, ("Add"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT, self.on_enter, self.text_ctrl_1)

        self.Bind(wx.EVT_BUTTON, self.on_close, self.button_close)
        self.Bind(wx.EVT_BUTTON, self.on_add, self.button_add)

        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.handle_keypress)

        self.NEW_YEAR=''
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def on_student_list(self, event):  # wxGlade: student_profie.<event_handler>

        # the combo box containing admission no
        self.current_admission_no=self.combo_box_adno.Value

        self.load_student_details()
        self.button_save.Label="Edit"
        self.add_flag=False
        self.set_editable(False)
        #self.bitmap_photo.Enable(True)
        self.Bind(wx.EVT_BUTTON, self.on_photo, self.bitmap_photo)
        #self.combo_box_adno.SetSelection(0)




        event.Skip()
项目:voiceid    作者:sih4sing5hong5    | 项目源码 | 文件源码
def create_central_panel(self,event,test_mode):
        """ Create a central panel for displaying data """
        if not self.central_panel == None:
            self.sizer.Clear()
            self.sizer.Detach(self.central_panel) 

        self.model.set_test_mode(test_mode) 

        self.central_panel = MainPanel(self.frame, test_mode)

        self.sizer.Insert(1,self.central_panel, 5, wx.EXPAND)

        self.central_panel.recordButton.Bind(wx.EVT_BUTTON, self.on_rec)
        self.central_panel.pauseButton.Bind(wx.EVT_BUTTON, self.on_pause)
        if test_mode == False:
            self.central_panel.time = MAX_TIME_TRAIN
            wx.CallAfter(Publisher().sendMessage, "update_status", "Read the following paragraph ")
        else:
            self.central_panel.pauseButton.Show()
            wx.CallAfter(Publisher().sendMessage, "update_status", "Speak in a natural way chanting the words properly ")

        self.sizer.Layout()
        self.frame.Layout()
项目:Project-Console-Game-Localization    作者:wmltogether    | 项目源码 | 文件源码
def __init__(self, parent, title = u"KUON FONT TOOL"):
        wx.Frame.__init__(self, parent, -1, title,pos=(150, 150), size=(400, 360))
        panel = wx.Panel(self, -1)
        self.button = wx.Button(panel, -1, u"??????", pos=(50, 20))
        wx.StaticText(panel ,-1 ,u"??????" ,(200, 20))
        self.Bind(wx.EVT_BUTTON, self.OnClick_expng,self.button)
        self.button.SetDefault()

        self.button1 = wx.Button(panel, -1, u"?????", pos=(50, 60))
        wx.StaticText(panel ,-1 ,u"?????" ,(200, 60))
        self.Bind(wx.EVT_BUTTON, self.OnClick_excharlist,self.button1)
        self.button1.SetDefault()

        self.button2 = wx.Button(panel, -1, u"??????", pos=(50, 100))
        wx.StaticText(panel ,-1 ,u"??????" ,(200, 100))
        self.Bind(wx.EVT_BUTTON, self.OnClick_exfont_info,self.button2)
        self.button2.SetDefault()

        self.button3 = wx.Button(panel, -1, u"??????", pos=(50, 140))
        wx.StaticText(panel ,-1 ,u"??????" ,(200, 140))
        self.Bind(wx.EVT_BUTTON, self.OnClick_buildfont,self.button3)
        self.button3.SetDefault()


        self.Show()
项目:hco-experiments    作者:zooniverse    | 项目源码 | 文件源码
def __init__(self, parent, frame, ID, label):
        wx.Panel.__init__(self, parent, ID)

        self.frame = frame
        box = wx.StaticBox(self, -1, label)
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        self.next_button = wx.Button(self, -1, label="Next 100")
        self.next_button.Bind(wx.EVT_BUTTON, self.on_next)
        self.previous_button = wx.Button(self, -1, label="Previous 100")
        self.previous_button.Bind(wx.EVT_BUTTON, self.on_previous)

        manual_box = wx.BoxSizer(wx.HORIZONTAL)
        manual_box.Add(self.previous_button, flag=wx.ALIGN_CENTER_VERTICAL)
        manual_box.AddSpacer(10)
        manual_box.Add(self.next_button, flag=wx.ALIGN_CENTER_VERTICAL)

        sizer.Add(manual_box, 0, wx.ALL, 10)

        self.SetSizer(sizer)
        sizer.Fit(self)
项目:hco-experiments    作者:zooniverse    | 项目源码 | 文件源码
def __init__(self, parent, frame, ID, label):
        wx.Panel.__init__(self, parent, ID)

        self.frame = frame
        box = wx.StaticBox(self, -1, label)
        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

        self.next_button = wx.Button(self, -1, label="Next 100")
        self.next_button.Bind(wx.EVT_BUTTON, self.on_next)
        self.previous_button = wx.Button(self, -1, label="Previous 100")
        self.previous_button.Bind(wx.EVT_BUTTON, self.on_previous)

        manual_box = wx.BoxSizer(wx.HORIZONTAL)
        manual_box.Add(self.previous_button, flag=wx.ALIGN_CENTER_VERTICAL)
        manual_box.AddSpacer(10)
        manual_box.Add(self.next_button, flag=wx.ALIGN_CENTER_VERTICAL)

        sizer.Add(manual_box, 0, wx.ALL, 10)

        self.SetSizer(sizer)
        sizer.Fit(self)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        """Constructor"""
        title = 'Get Children from Sizer'
        wx.Frame.__init__(self, None, title=title)
        panel = wx.Panel(self)

        lbl = wx.StaticText(panel, label="I'm a label!")
        txt = wx.TextCtrl(panel, value="blah blah")
        btn = wx.Button(panel, label="Clear")
        btn.Bind(wx.EVT_BUTTON, self.onClear)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(lbl, 0, wx.ALL, 5)
        self.sizer.Add(txt, 0, wx.ALL, 5)
        self.sizer.Add(btn, 0, wx.ALL, 5)

        panel.SetSizer(self.sizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)
        self.logger = logging.getLogger("wxApp")

        self.logger.info("Test from MyPanel __init__")

        logText = wx.TextCtrl(
            self,
            style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)

        btn = wx.Button(self, label="Press Me")
        btn.Bind(wx.EVT_BUTTON, self.onPress)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(logText, 1, wx.EXPAND|wx.ALL, 5)
        sizer.Add(btn, 0, wx.ALL, 5)
        self.SetSizer(sizer)

        txtHandler = CustomConsoleHandler(logText)
        self.logger.addHandler(txtHandler)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="Tutorial")

        self.eventDict = {}
        evt_names = [x for x in dir(wx) if x.startswith("EVT_")]
        for name in evt_names:
            evt = getattr(wx, name)
            if isinstance(evt, wx.PyEventBinder):
                self.eventDict[evt.typeId] = name

        grid_evt_names = [x for x in dir(wx.grid) if x.startswith("EVT_")]
        for name in grid_evt_names:
            evt = getattr(wx.grid, name)
            if isinstance(evt, wx.PyEventBinder):
                self.eventDict[evt.typeId] = name

        panel = wx.Panel(self, wx.ID_ANY)
        btn = wx.Button(panel, wx.ID_ANY, "Get POS")

        btn.Bind(wx.EVT_BUTTON, self.onEvent)
        panel.Bind(wx.EVT_LEFT_DCLICK, self.onEvent)
        panel.Bind(wx.EVT_RIGHT_DOWN, self.onEvent)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title='Richtext Test')

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.rt = wx.richtext.RichTextCtrl(self)
        self.rt.SetMinSize((300,200))

        save_button = wx.Button(self, label="Save")
        save_button.Bind(wx.EVT_BUTTON, self.on_save)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rt, 1, wx.EXPAND|wx.ALL, 6)
        sizer.Add(save_button, 0, wx.EXPAND|wx.ALL, 6)

        self.SetSizer(sizer)
        self.Show()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title='Richtext Test')

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.rt = wx.richtext.RichTextCtrl(self)
        self.rt.SetMinSize((300,200))

        save_button = wx.Button(self, label="Save")
        save_button.Bind(wx.EVT_BUTTON, self.on_save)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rt, 1, wx.EXPAND|wx.ALL, 6)
        sizer.Add(save_button, 0, wx.EXPAND|wx.ALL, 6)

        self.SetSizer(sizer)
        self.Show()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)
        self.currentlySelectedCell = (0, 0)

        self.myGrid = gridlib.Grid(self)
        self.myGrid.CreateGrid(12, 8)
        self.myGrid.Bind(gridlib.EVT_GRID_SELECT_CELL, self.onSingleSelect)
        self.myGrid.Bind(gridlib.EVT_GRID_RANGE_SELECT, self.onDragSelection)

        selectBtn = wx.Button(self, label="Get Selected Cells")
        selectBtn.Bind(wx.EVT_BUTTON, self.onGetSelection)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.myGrid, 1, wx.EXPAND)
        sizer.Add(selectBtn, 0, wx.ALL|wx.CENTER, 5)
        self.SetSizer(sizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="Timer Tutorial 2")

        panel = wx.Panel(self, wx.ID_ANY)

        self.timer = wx.Timer(self, id=TIMER_ID1)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer2 = wx.Timer(self, id=TIMER_ID2)
        self.Bind(wx.EVT_TIMER, self.update, self.timer2)

        self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start Timer 1")
        self.toggleBtn.Bind(wx.EVT_BUTTON, self.onStartTimerOne)
        self.toggleBtn2 = wx.Button(panel, wx.ID_ANY, "Start Timer 2")
        self.toggleBtn2.Bind(wx.EVT_BUTTON, self.onStartTimerOne)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.toggleBtn, 0, wx.ALL|wx.CENTER, 5)
        sizer.Add(self.toggleBtn2, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="Timer Tutorial 2")

        panel = wx.Panel(self, wx.ID_ANY)

        self.timer = wx.Timer(self, wx.ID_ANY)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer2 = wx.Timer(self, wx.ID_ANY)
        self.Bind(wx.EVT_TIMER, self.update, self.timer2)

        self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start Timer 1")
        self.toggleBtn.Bind(wx.EVT_BUTTON, self.onStartTimer)
        self.toggleBtn2 = wx.Button(panel, wx.ID_ANY, "Start Timer 2")
        self.toggleBtn2.Bind(wx.EVT_BUTTON, self.onStartTimer)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.toggleBtn, 0, wx.ALL|wx.CENTER, 5)
        sizer.Add(self.toggleBtn2, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)

        # Each value in the following dict is formatted as follows:
        # (timerNum, timerObj, secs between timer events)
        self.objDict = {self.toggleBtn: (1, self.timer, 1000),
                        self.toggleBtn2: (2, self.timer2, 3000)}
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def _assignEvents(self):
        eventManager.Register(self.onListen, wx.EVT_TOGGLEBUTTON, self.btnListen)
        eventManager.Register(self.onConnect, wx.EVT_TOGGLEBUTTON, self.btnConnect)
        eventManager.Register(lambda e: self.Close(), wx.EVT_BUTTON, self.btnClose)
        eventManager.Register(self.onSend, wx.EVT_BUTTON, self.btnSend)

    # Event handlers for gui framework
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        parent.CreateStatusBar() 
        menu= wx.Menu()
        menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
        menuBar = wx.MenuBar()
        menuBar.Append(menu, "File") 
        parent.SetMenuBar(menuBar)  
        button = wx.Button(self, label="Print", pos=(0,60))
        self.Bind(wx.EVT_BUTTON, self.writeToSharedQueue, button)
        self.textBox = wx.TextCtrl(self, size=(280,50), style=wx.TE_MULTILINE)   

    #-----------------------------------------------------------------
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
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)

        button = wx.Button(self, label="Quit")
        self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)  

        parent.CreateStatusBar()
项目:gopro-organizer    作者:angusmacdonald    | 项目源码 | 文件源码
def __init__(self, app, appName):
        self.model = model.OrganizerModel() #Todo Make organizer class

        pub.subscribe(self.action_processed, "STATUS UPDATE")

        #set up the first frame which displays the current Model value
        self.view = view.OrganizerView(None, title=appName)
        self.view.btnStartOrganizing.Bind(wx.EVT_BUTTON, self.start_organizing)

        self.view.Show()