Python wx 模块,EVT_CLOSE 实例源码

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

项目: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)
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def OnInit(self):
        frame = wx.Frame(None, -1, "RunDemo: ", pos=(0,0),
                        style=wx.DEFAULT_FRAME_STYLE, name="run a sample")

        menuBar = wx.MenuBar()
        menu = wx.Menu()
        item = menu.Append(wx.ID_EXIT, "E&xit", "Exit demo")
        self.Bind(wx.EVT_MENU, self.OnExitApp, item)
        menuBar.Append(menu, "&File")

        frame.SetMenuBar(menuBar)
        frame.Show(True)
        frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame)

        win = runTest(frame)

        # set the frame to a good size for showing the two buttons
        frame.SetSize((200,400))
        win.SetFocus()
        self.window = win
        frect = frame.GetRect()

        self.SetTopWindow(frame)
        self.frame = frame
        return True
项目:Taigabot    作者:FrozenPigs    | 项目源码 | 文件源码
def _test():
    class TestDialog(wxSpellCheckerDialog):
        def __init__(self,*args):
            wxSpellCheckerDialog.__init__(self,*args)
            wx.EVT_CLOSE(self,self.OnClose)
        def OnClose(self,evnt):
            chkr = dlg.GetSpellChecker()
            if chkr is not None:
                printf(["AFTER:", chkr.get_text()])
            self.Destroy()
    from enchant.checker import SpellChecker
    text = "This is sme text with a fw speling errors in it. Here are a fw more to tst it ut."
    printf(["BEFORE:", text])
    app = wx.PySimpleApp()
    dlg = TestDialog()
    chkr = SpellChecker("en_US",text)
    dlg.SetSpellChecker(chkr)
    dlg.Show()
    app.MainLoop()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def createWidgets(self):
        self.listCtrl = wxskinListCtrl(self, ID_LISTCTRL, style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL|wx.LC_VRULES|wx.LC_HRULES)
        self.listCtrl.InsertColumn(0, "Name")
        self.listCtrl.InsertColumn(1, "Number")

        ColumnSorterMixin.__init__(self, 2)

        self.currentItem = 0

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_LIST_ITEM_SELECTED(self, ID_LISTCTRL, self.OnItemSelected)
        wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL, self.OnItemActivated)
        wx.EVT_CLOSE(self, self.closeWindow)

        wx.EVT_LEFT_DCLICK(self.listCtrl, self.OnPopupEdit)
        wx.EVT_RIGHT_DOWN(self.listCtrl, self.OnRightDown)

        # for wxMSW and wxGTK respectively
        wx.EVT_COMMAND_RIGHT_CLICK(self.listCtrl, ID_LISTCTRL, self.OnRightClick)
        wx.EVT_RIGHT_UP(self.listCtrl, self.OnRightClick)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def createWidgets(self):
        # Main window resizer object
        sizer = wx.BoxSizer(wx.VERTICAL) 

        sizer.Add(topPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
        sizer.Add(bottomPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
        #buttons = wx.BoxSizer(wx.HORIZONTAL)
        #buttons.Add(wx.Button(self, ID_BUTTON_CHANGE_PIN, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        #buttons.Add(wx.Button(self, wxID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        #sizer.Add(buttons, 1, wx.ALL)

        self.SetSizer(sizer) 
        self.SetAutoLayout(1) 
        sizer.Fit(self)
        self.Layout()

        wx.EVT_CLOSE(self, self.closeWindow)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def createWidgets(self):
        self.listCtrl = wxskinListCtrl(self, ID_LISTCTRL, style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL|wx.LC_VRULES|wx.LC_HRULES)
        self.listCtrl.InsertColumn(0, "Name")
        self.listCtrl.InsertColumn(1, "Number")

        ColumnSorterMixin.__init__(self, 2)

        self.currentItem = 0

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_LIST_ITEM_SELECTED(self, ID_LISTCTRL, self.OnItemSelected)
        wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL, self.OnItemActivated)
        wx.EVT_CLOSE(self, self.closeWindow)

        wx.EVT_LEFT_DCLICK(self.listCtrl, self.OnPopupEdit)
        wx.EVT_RIGHT_DOWN(self.listCtrl, self.OnRightDown)

        # for wxMSW and wxGTK respectively
        wx.EVT_COMMAND_RIGHT_CLICK(self.listCtrl, ID_LISTCTRL, self.OnRightClick)
        wx.EVT_RIGHT_UP(self.listCtrl, self.OnRightClick)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def createWidgets(self):
        self.listCtrl = wxskinListCtrl(self, ID_LISTCTRL, style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL|wx.LC_VRULES|wx.LC_HRULES)
        self.listCtrl.InsertColumn(COL_STATUS, "Status")
        self.listCtrl.InsertColumn(COL_DATE, "Date")
        self.listCtrl.InsertColumn(COL_FROM, "From")
        self.listCtrl.InsertColumn(COL_MESSAGE, "Message")

        ColumnSorterMixin.__init__(self, 4)

        self.currentItem = 0

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_LIST_ITEM_SELECTED(self, ID_LISTCTRL, self.OnItemSelected)
        wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL, self.OnItemActivated)
        wx.EVT_RIGHT_DOWN(self.listCtrl, self.OnRightDown)
        wx.EVT_LEFT_DCLICK(self.listCtrl, self.OnPopupEdit)
        wx.EVT_CLOSE(self, self.closeWindow)

        # for wxMSW and wxGTK respectively
        wx.EVT_COMMAND_RIGHT_CLICK(self.listCtrl, ID_LISTCTRL, self.OnRightClick)
        wx.EVT_RIGHT_UP(self.listCtrl, self.OnRightClick)
项目:irida-miseq-uploader    作者:phac-nml    | 项目源码 | 文件源码
def __init__(self, parent=None, default_url=""):
        wx.Panel.__init__(self, parent)
        self._sizer = wx.BoxSizer(wx.HORIZONTAL)

        self._url = wx.TextCtrl(self)
        self._url.Bind(wx.EVT_KILL_FOCUS, self._field_changed)
        self._url.SetValue(default_url)

        self._status_label = ProcessingPlaceholderText(self)

        label = wx.StaticText(self, label="Server URL")
        label.SetToolTipString("URL for the IRIDA server API.")
        self._sizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5, proportion=0)
        self._sizer.Add(self._url, flag=wx.EXPAND, proportion=1)
        self._sizer.Add(self._status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0)

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

        self.Bind(wx.EVT_CLOSE, self._on_close)
        pub.subscribe(self._status_label.SetError, APIConnectorTopics.connection_error_url_topic)
        pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_topic)
        pub.subscribe(self._status_label.SetSuccess, APIConnectorTopics.connection_success_valid_url)
项目: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()
项目:grid    作者:russelg    | 项目源码 | 文件源码
def __init__(self, size=(300, 300), pos=(100, 100)):

        wx.Frame.__init__(self, None, title="Am I transparent?",
                          style=wx.SIMPLE_BORDER | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR)
        self.SetClientSize(size)
        self.SetPosition(pos)

        self.alphaValue = 220
        self.alphaIncrement = -4

        pnl = wx.Panel(self)
        # self.changeAlpha_timer = wx.Timer(self)
        # self.changeAlpha_timer.Start(50)
        # self.Bind(wx.EVT_TIMER, self.ChangeAlpha)
        self.MakeTransparent(self.alphaValue)

        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
项目:opc-rest-api    作者:matzpersson    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, parent=None, id=wx.ID_ANY,
                          title='Moogle HTTP to OPC Server', size=(800,600) )

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.row_colours = { 'rest': 'blue', 'opc': 'purple'}

        ## -- Configure Top Tool bar 
        tb = wx.ToolBar(self, style=TBFLAGS)
        sizer.Add(tb, 0, wx.EXPAND)
        tsize = (24,24)
        tb.SetToolBitmapSize(tsize)
        tb.Realize()

        self.list =  wx.ListCtrl(self, -1,
            style=wx.LC_REPORT 
            #| wx.BORDER_SUNKEN
            #| wx.BORDER_NONE
            | wx.LC_EDIT_LABELS
            | wx.LC_SORT_ASCENDING
            | wx.LC_NO_HEADER
            | wx.LC_VRULES
            | wx.LC_HRULES
            #| wx.LC_SINGLE_SEL
            ) 
        self.loadListviewHeader()

        sizer.Add(self.list, 1, wx.EXPAND)

        self.SetSizer(sizer)
        sizer.Layout()

        self.Bind(wx.EVT_CLOSE, self.onClose)
项目:python_2048    作者:OATOMO    | 项目源码 | 文件源码
def __init__(self,title):
        super(Frame,self).__init__(None,-1,title,style=wx.DEFAULT_FRAME_STYLE^wx.MAXIMIZE_BOX^wx.RESIZE_BORDER)
        self.colors = {0:(204,192,179),2:(238, 228, 218),4:(237, 224, 200),8:(242, 177, 121),16:(245, 149, 99),32:(246, 124, 95),64:(246, 94, 59),128:(237, 207, 114),256:(237, 207, 114),512:(237, 207, 114),1024:(237, 207, 114),2048:(237, 207, 114),4096:(237, 207, 114),8192:(237, 207, 114),16384:(237, 207, 114),32768:(237, 207, 114),65536:(237, 207, 114),131072:(237, 207, 114),262144:(237, 207, 114),524288:(237, 207, 114),1048576:(237, 207, 114),2097152:(237, 207, 114),4194304:(237, 207, 114),8388608:(237, 207, 114),16777216:(237, 207, 114)}#?????????

        self.setIcon()
        self.initGame()
        self.initBuffer()

        panel = wx.Panel(self)  #??????
        #------????
        panel.Bind(wx.EVT_KEY_DOWN,self.onKeyDown)
        panel.SetFocus() #?????
        self.Bind(wx.EVT_SIZE,self.onSize) #use wx.BufferedPaintDC
        self.Bind(wx.EVT_PAINT,self.onPaint)
        self.Bind(wx.EVT_CLOSE,self.onClose) #????
        #------

        self.SetClientSize((505,720)) #??????
        self.Center() #?????
        self.Show()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: Add_Student.__init__
        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.STAY_ON_TOP
        wx.Dialog.__init__(self, *args, **kwds)
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
        self.text_ctrl_3 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "Add")

        self.Bind(wx.EVT_CLOSE,self.OnClose,self)

        self.__set_properties()
        self.__do_layout()

        self.DB=db_operations()
        self.success=False
        self.STUDENT_INFO=[]
        # 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
项目:padherder_proxy    作者:jgoldshlag    | 项目源码 | 文件源码
def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(750,600))
        self.Bind(wx.EVT_CLOSE, self.onClose)
        self.Bind(custom_events.EVT_DNS_EVENT, self.onDNSEvent)
        self.proxy_master = None
        self.app_master = None

        p = wx.Panel(self)
        nb = wx.Notebook(p)

        self.main_tab = MainTab(nb)
        self.dns_tab = DNSLogTab(nb)
        settings_tab = SettingsTab(nb)
        self.mail_tab = MailTab(nb, self.main_tab)

        nb.AddPage(self.main_tab, "Proxy")
        nb.AddPage(self.dns_tab, "DNS Proxy Log")
        nb.AddPage(settings_tab, "Settings")
        nb.AddPage(self.mail_tab, "PAD Mail")

        sizer = wx.BoxSizer()
        sizer.Add(nb, 1, wx.EXPAND)
        p.SetSizer(sizer)

        self.Show(True)
项目:pyupdater-wx-demo    作者:wettenhj    | 项目源码 | 文件源码
def OnInit(self):
        """
        Run automatically when the wxPython application starts.
        """
        self.frame = wx.Frame(None, title="PyUpdater wxPython Demo")
        self.frame.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
        self.frame.SetSize(wx.Size(400, 100))
        self.statusBar = wx.StatusBar(self.frame)
        self.statusBar.SetStatusText(self.status)
        self.frame.SetStatusBar(self.statusBar)
        self.panel = wx.Panel(self.frame)
        self.sizer = wx.BoxSizer()
        self.sizer.Add(
            wx.StaticText(self.frame, label="Version %s" % __version__))
        self.panel.SetSizerAndFit(self.sizer)

        self.frame.Show()

        if hasattr(sys, "frozen") and \
                not os.environ.get('PYUPDATER_FILESERVER_DIR'):
            dlg = wx.MessageDialog(
                self.frame,
                "The PYUPDATER_FILESERVER_DIR environment variable "
                "is not set!", "PyUpdaterWxDemo File Server Error",
                wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()

        return True
项目:Netkeeper    作者:1941474711    | 项目源码 | 文件源码
def __init__(self, timelen, services):
        wx.Frame.__init__(self, parent=None, title=C_APP_NAME)
        self.timelen = timelen * 1000
        self.services = services
        self.Show(False)
        self.Bind(wx.EVT_TIMER, self.OnTimerEvent)
        self.Bind(wx.EVT_CLOSE, self.OnExitEvent)
        self.timer = wx.Timer(self)
        self.timer.Start(self.timelen)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def OnInit(self):
        self.twistedThread = TwistedThread(self, 'twistd.log')
        #self.twistedThread = TwistedThread(self)
        from twisted.internet.defer import Deferred
        Deferred.debug = 1
        self.main = ChatFrame()
        eventManager.Register(self.onClose, wx.EVT_CLOSE, self.main)
        self.main.Show()
        return True
项目:Gym_LineFollower    作者:Chachay    | 项目源码 | 文件源码
def __init__(self, parent=None, id=-1, title=None):
        wx.Frame.__init__(self, parent, id, title)
        self.MainPanel = wx.Panel(self, size=(640, 480))
        self.MainPanel.SetBackgroundColour('WHITE')

        self.panel = wx.Panel(self.MainPanel, size = (640,480))
        self.panel.SetBackgroundColour('WHITE')

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.panel)

        self.SetSizer(mainSizer)
        self.Fit()

        self.Bind(wx.EVT_CLOSE, self.CloseWindow)

        self.World = None

        self.cdc = wx.ClientDC(self.panel)
        w, h = self.panel.GetSize()
        self.bmp = wx.EmptyBitmap(w,h)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)

        self.timer.Start(20)
项目:nodemcu-pyflasher    作者:marcelstoer    | 项目源码 | 文件源码
def __init__(self):
        wx.SplashScreen.__init__(self, images.Splash.GetBitmap(),
                                 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                                 2500, None, -1)
        self.Bind(wx.EVT_CLOSE, self._on_close)
        self.__fc = wx.FutureCall(2000, self._show_main)
项目:pyqha    作者:mauropalumbo75    | 项目源码 | 文件源码
def __init__(self, title, pos, size):

        # Initialize some flags
        self.IsEtotRead = False

        wx.Frame.__init__(self, None, -1, title, pos, size)                
        panel = wx.Panel(self, -1)
        panel.SetBackgroundColour("White")

        text = wx.TextCtrl(self, wx.ID_ANY, size=size, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(text, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Fit()

        self.Bind(wx.EVT_CLOSE, self.OnQuit)                             
        self.createMenuBar()       
        self.CreateStatusBar()        
        self.SetStatusText("Welcome to pyQHA")

        # Redirect stout to the TextCtrl in the main panel
        self.redir=RedirectText(text)
        sys.stdout=self.redir
        sys.stderr=self.redir

    ############################################################################
    #
    # Menu functions
    #
项目:CSB    作者:csb-toolbox    | 项目源码 | 文件源码
def _add(self, figure):

        wx = self._wx
        FigureFrameWx = self._FigureFrameWx

        if figure not in self._figures:

            frame = FigureFrameWx(figure._figure_number, figure)
            frame.Show()
            frame.Bind(wx.EVT_ACTIVATE, lambda e: e.GetEventObject().Layout())
            frame.Bind(wx.EVT_CLOSE, lambda e: self.invoke(self._hide, figure))

            self._figures[figure] = frame
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def CreateMenuBar(self):
        menubar = wx.MenuBar()
        fileMenu = wx.Menu()
        nitem = fileMenu.Append(wx.ID_NEW,  '&New',  'New project' )
        oitem = fileMenu.Append(wx.ID_OPEN, '&Open', 'Open project')
        self.ritem = fileMenu.Append(wx.ID_SAVEAS, '&Render\tCtrl-r', 'Render')
        self.iitem = fileMenu.Append(wx.ID_ANY, '&Import\tCtrl-i', 'Import image directory')
        self.qitem = fileMenu.Append(wx.ID_EXIT, '&Quit', 'Quit application')

        editMenu = wx.Menu()
        self.zitem = editMenu.Append(wx.ID_UNDO, '&Undo\tCtrl-z', 'Undo Delete')
        #yitem = editMenu.Append(wx.ID_REDO, '&Redo', 'Redo')
        self.ditem = editMenu.Append(wx.ID_DELETE, '&Delete\tDelete', 'Delete')
        pitem = editMenu.Append(wx.ID_PREFERENCES, '&Preferences\tCtrl-,', 'Preferences')

        helpMenu = wx.Menu()
        aitem = helpMenu.Append(wx.ID_ABOUT, '&About\tCtrl-?', 'About Stopgo')

        menubar.Append(fileMenu, '&File')
        menubar.Append(editMenu, '&Edit')
        menubar.Append(helpMenu, '&Help')

        self.Bind(wx.EVT_MENU, lambda event, args=(False): self.OpenFile(event,args), oitem)
        self.Bind(wx.EVT_MENU, self.NewFile, nitem)
        self.Bind(wx.EVT_MENU, self.Pref, pitem)
        self.Bind(wx.EVT_MENU, lambda event,args=(False): ingest.Ingest(self),self.iitem)
        self.Bind(wx.EVT_MENU, self.SimpleQuit, self.qitem)
        self.Bind(wx.EVT_CLOSE, self.SimpleQuit, self.qitem)
        self.Bind(wx.EVT_MENU, self.About, aitem)
        self.SetMenuBar(menubar)
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def BindKeys(self,dbfile):
        '''
        Bind keyboard shortcuts for application.
        '''
        self.Bind(wx.EVT_MENU, lambda event, args=('MENU_DEL',dbfile): self.OnKeyDown(event,args), self.ditem)
        self.Bind(wx.EVT_MENU, lambda event, args=dbfile: self.Undo(event,args), self.zitem)
        self.Bind(wx.EVT_BUTTON, lambda event, args=('wx.WXK_SPACE',dbfile): self.OnKeyDown(event,args), self.bplay)
        self.Bind(wx.EVT_BUTTON, lambda event, args=(dbfile): self.CaptureCanvas(event,args), self.brec)

        self.panel3.Bind(wx.EVT_KEY_DOWN, lambda event, args=(dbfile): self.OnKeyDown(event, args))
        self.panel3.Bind(wx.EVT_LEFT_DOWN, self.OnMouseClick)
        self.Bind(wx.EVT_MENU, lambda event, args=(dbfile):self.OnQuit(event,args), self.qitem)
        self.Bind(wx.EVT_CLOSE, lambda event, args=(dbfile):self.OnQuit(event,args), self.qitem)
        self.Bind(wx.EVT_MENU, lambda event, args=(dbfile):self.OnRender(event,args), self.ritem)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def createFrames(self):
        # Create the layout component and add controls to it
        self.sizer1 = wx.BoxSizer(wx.HORIZONTAL)
        self.bConnect = wx.Button(self, ID_BUTTON_CONNECT, "Connect reader")
        self.sizer1.Add(self.bConnect, 1, wx.EXPAND|wx.ALL)

        self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        self.bPhonebook = wx.Button(self, ID_BUTTON_PHONEBOOK, "Phonebook")
        self.bSMS = wx.Button(self, ID_BUTTON_SMS, "SMS")
        self.sizer2.Add(self.bPhonebook, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
        self.sizer2.Add(self.bSMS, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 5)

        self.sizer3 = wx.BoxSizer(wx.HORIZONTAL)
        self.bExit = wx.Button(self, ID_BUTTON_EXIT, "Quit")

        self.sizer3.Add(self.bExit, 1, wx.EXPAND|wx.ALL)

        # Use sizers to set layout options
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.sizer1,1,wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP,15)
        self.sizer.Add(self.sizer2,1,wx.EXPAND|wx.ALL,10)
        self.sizer.Add(self.sizer3,1,wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM,15)
        self.sizer.SetMinSize((250,150))

        # Layout for frame
        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)
        self.sizer.Fit(self)

        # Add the button handlers
        wx.EVT_BUTTON(self, ID_BUTTON_CONNECT, self.buttonConnectReader)
        wx.EVT_BUTTON(self, ID_BUTTON_PHONEBOOK, self.buttonPhonebook)
        wx.EVT_BUTTON(self, ID_BUTTON_SMS, self.buttonSMS)
        wx.EVT_BUTTON(self, ID_BUTTON_EXIT, self.closeWindow)
        wx.EVT_CLOSE(self, self.closeWindow)
项目:FestEngine    作者:Himura2la    | 项目源码 | 文件源码
def open_window(self, pre_close_func):
        self.log_win = LogWindow(self.parent)
        self.log_win.Show()
        self.log_win.append_message(self.log_text)

        def on_close(e):
            pre_close_func()
            self.log_win.Destroy()
            self.log_win = None
        self.log_win.Bind(wx.EVT_CLOSE, on_close)
项目:MaTags    作者:hastelloy    | 项目源码 | 文件源码
def __init__(self, parent, title):
        style = wx.DEFAULT_FRAME_STYLE & ~(
            wx.RESIZE_BORDER | wx.MAXIMIZE_BOX |
            wx.MINIMIZE_BOX|wx.CLOSE_BOX)

        wx.Frame.__init__(self, parent, title=title, 
            style=style, size=(400,60))
        self.textbox = wx.TextCtrl(self)

        img = wx.Image("matags.png", wx.BITMAP_TYPE_ANY)
        bmp = wx.Bitmap(img)
        self.icon = wx.Icon()
        self.icon.CopyFromBitmap(bmp)
        self.SetIcon(self.icon)

        self.tbIcon = wx.adv.TaskBarIcon()
        self.tbIcon.SetIcon(self.icon)

        self.Show(True)
        self.Centre()

        self.reg_hot_keys()        
        self.Bind(wx.EVT_HOTKEY, self.on_extract_tag, 
            id=self.hotkeys['extract_tag'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_close, 
            id=self.hotkeys['quit'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_activate, 
            id=self.hotkeys['activate'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_refresh, 
            id=self.hotkeys['refresh'][0])
        self.textbox.Bind(wx.EVT_CHAR, self.check_key)
        # do not use EVT_KEY_DOWN, 
        # it becomes difficult to get lower case
        # self.textbox.Bind(wx.EVT_KEY_DOWN, self.check_key)
        # self.Bind(wx.EVT_CLOSE, self.on_close)
        self.Bind(wx.EVT_ICONIZE, self.on_iconify)
        self.matags = MaTags()
        # try:
        # except Exception as e:
        #     self.textbox.ChangeValue(e.args[0].decode('utf8', 'ignore'))
        #     self.textbox.Disable()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def __init__(self):
        """Initialize the main GUI frame.
        """
        # set frame size to reasonable value
        ##displaySize = [int(0.75*s) for s in wx.DisplaySize()]

        # hack to help on dual-screen, need something better XXX - idfah
        displaySize = wx.DisplaySize()
        displaySize = 1.2*displaySize[1], 0.75*displaySize[1]

        # call base class constructor
        wx.Frame.__init__(self, parent=None, title='CEBL3', size=displaySize)

        # initialize the main notebook
        self.initNotebook()

        # initialize the page and source manager
        self.mgr = Manager(pageParent=self.notebook, statusPanel=self)

        # add all pages to the notebook
        self.initNotebookPages()

        # initialize the status bar
        self.initStatusBar()

        # initialize the top-level layout
        self.initLayout()

        # cleanup when main frame is closed
        self.Bind(wx.EVT_CLOSE, self.close)

        # toggle full screen on EVT_FULLSCREEN events
        self.Bind(events.EVT_FULLSCREEN, self.toggleFullScreen)

        # update the status bar on EVT_UPDATE_STATUS events
        self.Bind(events.EVT_UPDATE_STATUS, self.updateStatusBar)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def __init__(self, parent, agwStyle=aui.AUI_NB_TOP | aui.AUI_NB_TAB_SPLIT):
        aui.AuiNotebook.__init__(self, parent=parent, agwStyle=agwStyle | aui.AUI_NB_TAB_FLOAT)

    #def FloatPage(self, page_index):
    #    pageTitle = self.GetPageText(page_index)
    #    pageContents = self.GetPage(page_index)

    #    frame = wx.Frame(self, title=pageTitle,
    #        size=self.GetClientSize(),
    #        style=wx.DEFAULT_FRAME_STYLE)

    #    self.RemovePage(page_index)
    #    pageContents.Reparent(frame)

    #    frame.Bind(wx.EVT_CLOSE, self.closeFloatPage)
    #    frame.Move(wx.GetMousePosition())
    #    frame.Show()

    #def closeFloatPage(self, event):
    #    self.floated = False
    #    event.Skip()

    #    frame = event.GetEventObject()

    #    pageTitle = frame.GetTitle()
    #    pageContents = frame.GetChildren()[0]
    #    pageContents.Reparent(self)

    #    self.AddPage(pageContents, pageTitle, select=True)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def FloatPage(self, page_index):
        root_manager = aui.GetManager(self)
        page_title = self.GetPageText(page_index)
        page_contents = self.GetPage(page_index)
        page_bitmap = self.GetPageBitmap(page_index)
        text_colour = self.GetPageTextColour(page_index)
        info = self.GetPageInfo(page_index)

        frame = FloatingFrame(self, title=page_title,
            size=self.GetClientSize(), # request add to standard AuiNotebook? XXX - idfah
            style=wx.DEFAULT_FRAME_STYLE)
                         #style=wx.DEFAULT_FRAME_STYLE|wx.FRAME_TOOL_WINDOW|
                         #      wx.FRAME_FLOAT_ON_PARENT | wx.FRAME_NO_TASKBAR)

        if info.control:
            info.control.Reparent(frame)
            info.control.Hide()

        frame.bitmap = page_bitmap
        frame.page_index = page_index
        frame.text_colour = text_colour
        frame.control = info.control
        page_contents.Reparent(frame)
        frame.Bind(wx.EVT_CLOSE, self.OnCloseFloatingPage)
        frame.Move(wx.GetMousePosition())
        frame.Show()
        page_contents.SetFocus()

        self.RemovePage(page_index)
        self.RemoveEmptyTabFrames()

        wx.CallAfter(self.RemoveEmptyTabFrames)

    #def FloatPage(self, page_index):
    #    page_contents = self.GetPage(page_index)
    #    size = page_contents.GetSize()

    #    aui.AuiNotebook.FloatPage(self, page_index)

    #    page_contents.GetParent().SetSize(size)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,"Test App")
        self.renderer = Renderer(self)
        self.log = MyTextCtrl(self)
        self.Canvas = MyCanvas(self)

        sizer = wx.BoxSizer()
        sizer.Add(self.Canvas,3,wx.EXPAND)
        sizer.Add(self.log,1,wx.EXPAND)
        self.SetSizer(sizer)

        self.Bind(wx.EVT_CLOSE,self.OnExit)
        self.Show(True)
项目:Crypter    作者:sithis993    | 项目源码 | 文件源码
def show_decryption_dialog(self, event):
        '''
        @summary: Creates a dialog object to show the decryption dialog
        '''

        # If dialog open. Don't open another
        if self.decryption_dialog:
            return

        # Create dialog object
        self.decryption_dialog = EnterDecryptionKeyDialog(self)
        # Set gauge size
        self.decryption_dialog.DecryptionGauge.SetRange(100)
        # Set encrypted file number
        self.decryption_dialog.EncryptedFilesNumberLabel.SetLabelText(
            self.GUI_DECRYPTION_DIALOG_LABEL_TEXT_FILE_COUNT[self.LANG] + str(
                len(self.encrypted_files_list) - len(self.decrypted_files_list)
                )
            )

        # Bind OK button to decryption process
        self.decryption_dialog.Bind(wx.EVT_BUTTON, self.start_decryption_thread, self.decryption_dialog.OkCancelSizerOK)
        # Bind close and cancel event to thread killer
        self.decryption_dialog.Bind(wx.EVT_BUTTON, self.stop_decryption, self.decryption_dialog.OkCancelSizerCancel)
        self.decryption_dialog.Bind(wx.EVT_CLOSE, self.stop_decryption)
        self.decryption_dialog.Show()
项目:kicad_scripts    作者:NilujePerchut    | 项目源码 | 文件源码
def __init__(self, board):
        """Init the brand new instance"""
        super(TeardropDialog, self).__init__(None)
        self.board = board
        self.SetTitle("Teardrops (v{0})".format(__version__))
        self.rbx_action.Bind(wx.EVT_RADIOBOX, self.onAction)
        self.Bind(wx.EVT_CLOSE, self.onCloseWindow)
        self.but_cancel.Bind(wx.EVT_BUTTON, self.onCloseWindow)
        self.but_ok.Bind(wx.EVT_BUTTON, self.onProcessAction)
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__(self, *args, **kw):
        super(edit_gpio_dialog, self).__init__(*args, **kw)
        self.InitUI()
        self.SetSize((750, 300))
        self.SetTitle("Device GPIO config")
        self.Bind(wx.EVT_CLOSE, self.OnClose)
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__(self, *args, **kw):
        super(cron_job_dialog, self).__init__(*args, **kw)
        self.InitUI()
        self.SetSize((750, 300))
        self.SetTitle("Cron Job Editor")
        self.Bind(wx.EVT_CLOSE, self.OnClose)
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__(self, *args, **kw):
        super(file_download_dialog, self).__init__(*args, **kw)
        self.InitUI()
        self.SetSize((600, 300))
        self.SetTitle("Download files from Pigrow")
        self.Bind(wx.EVT_CLOSE, self.OnClose)
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__(self, *args, **kw):
        super(upload_dialog, self).__init__(*args, **kw)
        self.InitUI()
        self.SetSize((600, 355))
        self.SetTitle("upload files to Pigrow")
        self.Bind(wx.EVT_CLOSE, self.OnClose)
项目:Pigrow    作者:Pragmatismo    | 项目源码 | 文件源码
def __init__(self, parent):
        MainFrame.__init__(self, parent)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        MainApp.pi_link_pnl = pi_link_pnl(self)
        self.view_pnl = view_pnl(self)
        #
        #Set the local file paths for this computer_username
        self.set_local_options()
        #
        # loads all the pages at the start then hides them,
        #         maybe i should change this later but let's make it work first
        MainApp.welcome_pannel = welcome_pnl(self)
        MainApp.system_ctrl_pannel = system_ctrl_pnl(self)
        MainApp.system_info_pannel = system_info_pnl(self)
        MainApp.config_ctrl_pannel = config_ctrl_pnl(self)
        MainApp.config_info_pannel = config_info_pnl(self)
        MainApp.cron_list_pannel = cron_list_pnl(self)
        MainApp.cron_info_pannel = cron_info_pnl(self)
        MainApp.localfiles_ctrl_pannel = localfiles_ctrl_pnl(self)
        MainApp.localfiles_info_pannel = localfiles_info_pnl(self)
        #hide all except the welcome pannel
        MainApp.system_ctrl_pannel.Hide()
        MainApp.system_info_pannel.Hide()
        MainApp.config_ctrl_pannel.Hide()
        MainApp.config_info_pannel.Hide()
        MainApp.cron_list_pannel.Hide()
        MainApp.cron_info_pannel.Hide()
        MainApp.localfiles_ctrl_pannel.Hide()
        MainApp.localfiles_info_pannel.Hide()
项目:PyHook3    作者:gggfreak2003    | 项目源码 | 文件源码
def __init__(self):
    wx.Frame.__init__(self, None, -1, 'My Frame')

    self.hm = PyHook3.HookManager()
    self.hm.MouseAllButtonsDown = self.OnMouseEvent
    self.hm.KeyDown = self.OnKeyboardEvent

    self.hm.HookMouse()
    self.hm.HookKeyboard()

    wx.EVT_CLOSE(self, self.OnClose)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title="Measure Scene", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
        self.SetSizeHints(640,480,-1,-1)
        self.Bind(wx.EVT_CLOSE, self.OnExit)
        self.panelvisual = self.GetParent()
        self.nb = wx.Notebook(self)
        self.nb.AddPage(MeasureLine(self.nb), "Line Scan")
        self.nb.AddPage(MeasureAngle(self.nb), "Angle")
        self.nb.AddPage(OrientXYZ(self.nb), "Orientation")
        sizer = wx.BoxSizer()
        sizer.Add(self.nb, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Fit()
        self.Layout()
        self.Show()
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, title):
        self.dirname=os.getcwd()
        wx.Frame.__init__(self, parent, title=title, size=(1000,700))
        self.SetSizeHints(1000,700,-1,-1)
        self.CreateStatusBar()
        filemenu= wx.Menu()
        menuOpen = filemenu.Append(wx.ID_OPEN, "&Open"," Open saved state")
        menuSave = filemenu.Append(wx.ID_SAVE, "&Save"," Save current state")
        filemenu.InsertSeparator(2)
        menuNew = filemenu.Append(wx.ID_NEW, "&New"," Create new session")
        filemenu.InsertSeparator(4)
        menuExit = filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program")
        viewmenu = wx.Menu()
        vismenu = wx.Menu()
        self.viewmenuundock = vismenu.Append(wx.ID_ANY,"&Undock","Undock the visualisation")
        self.viewmenuundock.Enable(0)
        self.viewmenudock = vismenu.Append(wx.ID_ANY,"&Dock","Dock the visualisation")
        self.viewmenudock.Enable(0)
        self.Bind(wx.EVT_MENU, self.OnUndock, self.viewmenuundock)
        self.Bind(wx.EVT_MENU, self.OnDock, self.viewmenudock)
        if IsNotWX4():
            viewmenu.AppendMenu(wx.ID_ANY,"&Visualisation", vismenu)
        else:
            viewmenu.Append(wx.ID_ANY,"&Visualisation", vismenu)
        self.visualdialog_docked = True
        editmenu = wx.Menu()
        self.menuCWD = editmenu.Append(wx.ID_ANY, "Current Working &Directory","Current Working Directory")
        self.Bind(wx.EVT_MENU, self.OnCWD, self.menuCWD)
        helpmenu= wx.Menu()
        menuAbout= helpmenu.Append(wx.ID_ABOUT, "&About"," Information about Bonsu")
        menuDoc= helpmenu.Append(wx.ID_HELP, "&Contents","Documentation")
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&File")
        menuBar.Append(viewmenu,"&View")
        menuBar.Append(editmenu,"&Edit")
        menuBar.Append(helpmenu,"&Help")
        self.SetMenuBar(menuBar)
        self.Bind(wx.EVT_MENU, self.OnOpen, menuOpen)
        self.Bind(wx.EVT_MENU, self.OnSave, menuSave)
        self.Bind(wx.EVT_MENU, self.OnNew, menuNew)
        self.Bind(wx.EVT_MENU, self.OnExit, menuExit)
        self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
        self.Bind(wx.EVT_MENU, self.OnHelp, menuDoc)
        self.Bind(wx.EVT_CLOSE, self.OnExit)
        self.fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()
        self.font = wx.Font(self.fontpointsize, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        self.SetFont(self.font)
        icon = wx.Icon(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'image',  'bonsu.ico'), wx.BITMAP_TYPE_ICO)
        wx.Frame.SetIcon(self, icon)
        self.nb = None
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.Fit()
        self.Layout()
        self.Show()
项目:Supplicant    作者:mayuko2012    | 项目源码 | 文件源码
def __init__(self, title, pos, size):

        self.threads = []
        self.getsession = []
        self.MAC=''
        self.IP=''
        wx.Frame.__init__(self, None, -1, title, pos, size)
        menuFile = wx.Menu()
        menuFile.Append(1, u"&??...",u"?????")
        menuFile.Append(3,u"&????",u"?????IP")
        menuFile.AppendSeparator() 
        menuFile.Append(2,u"&Bug Report",u"???????bug?")
        menuBar = wx.MenuBar()
        menuBar.Append(menuFile, u"&??")
        self.SetMenuBar(menuBar)
        self.Bind(wx.EVT_MENU, self.OnAbout,id=1)
        self.Bind(wx.EVT_MENU,self.OnBugReport,id=2)
        hosts = self.Bind(wx.EVT_MENU,self.OnSet,id=3)
        self.CreateStatusBar() 

        self.SetStatusText(u"????")

        panel = wx.Panel(self) 
        self.connect = wx.Button(panel,label=u"??",pos=(240, 60),size=(80, 50)) 
        self.disconnect = wx.Button(panel,label=u"??",pos=(330,60),size=(80,50))
        self.connect.Disable()
        self.disconnect.Disable()
        self.Bind(wx.EVT_BUTTON, self.OnDisconnect,self.disconnect)
        self.Bind(wx.EVT_BUTTON,self.OnConnect,self.connect)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)         
        wx.StaticText(panel, -1, u"???:", pos=(28, 40))
        self.username = wx.TextCtrl(panel, -1 ,pos=(80, 40))
        self.username.SetInsertionPoint(0)
        self.Bind(wx.EVT_TEXT,self.Onuser,self.username)
        wx.StaticText(panel,-1,u"??:",pos=(242,40))
        self.pwd = wx.TextCtrl(panel, -1,pos=(280,40),style=wx.TE_PASSWORD |wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT,self.Onpwd,self.pwd)
        wx.CheckBox(panel, -1, u"????", (20, 80), (150, 20))
        wx.CheckBox(panel, -1, u"????", (110, 80), (150, 20))
项目:pinder    作者:dhharris    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, wx.ID_ANY, 'Facebook Login', size= (650,220))
        self.panel = wx.Panel(self,wx.ID_ANY)

        self.lbluser = wx.StaticText(self.panel, label='Username', pos=(20,20))
        self.user = wx.TextCtrl(self.panel, value="", pos=(110,20), size=(500,-1))
        self.lblpassword = wx.StaticText(self.panel, label='Password', pos=(20,60))
        self.password = wx.TextCtrl(self.panel, value="", pos=(110,60), size=(500,-1), style=wx.TE_PASSWORD)

        self.submitButton =wx.Button(self.panel, label='Submit', pos=(110,160))
        self.closeButton = wx.Button(self.panel, label='Cancel', pos=(210,160))
        self.submitButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
        self.Bind(wx.EVT_CLOSE, self.OnQuit)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent, file):
        super(WaveformPlot, self).__init__(parent=parent, title="pyjam Waveform Viewer",
                                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.file = file

        self.plot = plot.PlotCanvas(self)
        self.plot.canvas.Bind(wx.EVT_LEFT_DOWN, self.lmb_down)
        self.plot.canvas.Bind(wx.EVT_LEFT_UP, self.lmb_up)
        self.plot.canvas.Bind(wx.EVT_MOTION, self.mouse_motion)
        self.plot.EnableAxesValues = (True, False, False, False)
        self.plot.EnableGrid = (True, False)
        self.plot.AbsScale = (True, False)
        self.plot.EnableAntiAliasing = True

        self.panel = WaveformPanel(self)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.plot, 1, wx.EXPAND, 0)
        sizer.Add(self.panel, 0, wx.EXPAND, 0)
        self.SetSizerAndFit(sizer)
        self.SetSize(800, self.GetSize()[1])
        self.SetMinSize(self.GetSize())

        self.player = wx.media.MediaCtrl(parent=self, style=wx.SIMPLE_BORDER)

        self.volume = 25
        self.selected = np.array([0.0, 0.0])
        self.maximum = 0.0
        self.minimum = 0.0
        self.selection_drawn = False
        self.resized = False

        self.timer = wx.Timer(self)

        self.Bind(wx.EVT_SIZE, self.on_size)
        self.Bind(wx.EVT_TIMER, self.on_timer)
        self.Bind(wx.EVT_IDLE, self.on_idle)
        self.Bind(wx.EVT_CLOSE, self.on_exit)

        self.load()
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def InitUI(self):
        self.panel = wx.Panel(self, wx.ID_ANY)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.html = help = wx.html.HtmlWindow(self.panel, -1, style=wx.NO_BORDER)

        # http://wxpython-users.1045709.n5.nabble.com/Open-a-URL-with-the-default-browser-from-an-HtmlWindow-td2326349.html
        # Bind LINK Click Event to own Function
        help.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)

        #import codecs
        #file = codecs.open(self.help, "r", "utf-8")
        try:
            file = open(self.help, "r")
        except IOError:
            dlgmsg = u"File not found: \"{}\"".format(self.help)
            dlg = wx.MessageDialog(None, dlgmsg, "WPKG-GP Client", wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            self.Destroy()
        else:
            test = file.read().decode("utf-8")
            html = markdown2.markdown(test, extras=["tables"])
            html = '<body bgcolor="#f0f0f5">' + html
            #print html
            help.SetPage(html)
            sizer.Add(help, 1, wx.EXPAND)
            self.panel.SetSizerAndFit(sizer)
            self.Bind(wx.EVT_CLOSE, self.OnClose)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def InitUI(self):
        self.panel = wx.Panel(self, wx.ID_ANY)
        self.textbox = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.textbox.SetValue(self.log)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.textbox, 1, wx.ALL | wx.EXPAND, 5)
        self.panel.SetSizerAndFit(self.sizer)
        self.Center()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
项目:wpkg-gp-client    作者:sonicnkt    | 项目源码 | 文件源码
def InitUI(self):
        self.panel = wx.Panel(self, wx.ID_ANY)
        self.textbox = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.textbox.SetValue(self.log)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.textbox, 1, wx.ALL | wx.EXPAND, 5)
        self.panel.SetSizerAndFit(self.sizer)
        self.Center()
        self.Bind(wx.EVT_CLOSE, self.OnClose)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, fileOpen=None):
        """ Constructor of the PLCOpenEditor class.

        :param parent: The parent window.
        :param fileOpen: The filepath to open if no controler defined (default: None).
        """
        self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO)
        IDEFrame.__init__(self, parent)

        result = None

        # Open the filepath if defined
        if fileOpen is not None:
            fileOpen = DecodeFileSystemPath(fileOpen, False)
            if os.path.isfile(fileOpen):
                # Create a new controller
                controler = PLCControler()
                result = controler.OpenXMLFile(fileOpen)
                self.Controler = controler
                self.LibraryPanel.SetController(controler)
                self.ProjectTree.Enable(True)
                self.PouInstanceVariablesPanel.SetController(controler)
                self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)

        # Define PLCOpenEditor icon
        self.SetIcon(self.icon)

        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)

        self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)

        if result is not None:
            (num, line) = result
            self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line))
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def _init_ctrls(self, prnt):
            wx.Frame.__init__(self, id=ID_HTMLFRAME, name='HtmlFrame',
                              parent=prnt, pos=wx.Point(320, 231), size=wx.Size(853, 616),
                              style=wx.DEFAULT_FRAME_STYLE, title='')
            self.SetIcon(prnt.icon)
            self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)

            self.HtmlContent = UrlClickHtmlWindow(id=ID_HTMLFRAMEHTMLCONTENT,
                                                  name='HtmlContent', parent=self, pos=wx.Point(0, 0),
                                                  size=wx.Size(-1, -1), style=wx.html.HW_SCROLLBAR_AUTO | wx.html.HW_NO_SELECTION)
            self.HtmlContent.Bind(HtmlWindowUrlClick, self.OnLinkClick)
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__(self, parent, title='Frame3D', manager=None):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = wx.Size( 800,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        sizer = wx.BoxSizer( wx.VERTICAL )
        root = os.path.abspath(os.path.dirname(__file__))

        self.SetIcon(wx.Icon(os.path.join(root, 'imgs/logo.ico'), wx.BITMAP_TYPE_ICO))
        self.viewer = canvas3d.Viewer3D( self , manager)
        sizer.Add( self.viewer, 1, wx.EXPAND |wx.ALL, 0 )
        self.Bind(wx.EVT_CLOSE, self.on_closing)

        self.SetSizer( sizer )
        self.Layout()

        self.Centre( wx.BOTH )