Python wx 模块,ID_OPEN 实例源码

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

项目:irida-miseq-uploader    作者:phac-nml    | 项目源码 | 文件源码
def _build_menu(self):
        """Build the application menu."""
        menubar = wx.MenuBar()
        file_menu = wx.Menu()
        help_menu = wx.Menu()

        self.Bind(wx.EVT_MENU, self._directory_chooser, file_menu.Append(wx.ID_OPEN, 'Open directory...'))
        self.Bind(wx.EVT_MENU, self._open_settings, file_menu.Append(wx.ID_PROPERTIES, 'Settings...'))
        file_menu.AppendSeparator()
        self.Bind(wx.EVT_MENU, lambda evt: self.Close(), file_menu.Append(wx.ID_EXIT))
        self.Bind(wx.EVT_MENU, self._open_about, help_menu.Append(wx.ID_ABOUT))
        self.Bind(wx.EVT_MENU, lambda evt: wx.LaunchDefaultBrowser("http://irida-miseq-uploader.readthedocs.io/en/latest/"), help_menu.Append(wx.ID_HELP))

        menubar.Append(file_menu, '&File')
        menubar.Append(help_menu, '&Help')
        self.SetMenuBar(menubar)
项目: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)
项目: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()
项目:JincinExamHelper    作者:Qinet    | 项目源码 | 文件源码
def __init__(self, parent, title):
        (self.display_length_, self.display_height_) = wx.GetDisplaySize()
        self.frame_width_ = self.display_length_ * 90 / 100
        self.frame_height_ = self.display_height_ * 90 / 100
        self.answer_panel_width_ = self.frame_width_ * 15 / 100
        super(MainFrame, self).__init__(parent=parent, title=title, size=(self.frame_width_, self.frame_height_))

        self.splitter = wx.SplitterWindow(parent=self, style=wx.SP_LIVE_UPDATE)
        self.splitter.SetMinimumPaneSize(min=100)

        self.web_panel = WebPanel(parent=self.splitter)
        self.answer_panel = wx.Panel(parent=self.splitter)
        self.answers_box = wx.BoxSizer(orient=wx.VERTICAL)
        self.answers_box.Add(item=self.answer_panel)

        self.splitter.SplitVertically(window1=self.answer_panel, window2=self.web_panel,
                                      sashPosition=self.answer_panel_width_)

        self.Sizer = wx.BoxSizer(orient=wx.VERTICAL)
        self.Sizer.Add(item=self.splitter, proportion=CAN_CHANGE, flag=wx.EXPAND)

        auto_answer_button = wx.Button(parent=self, label=u"????")
        self.Bind(event=wx.EVT_BUTTON, handler=self.click_search_answer, source=auto_answer_button)

        self.buttons_box = wx.BoxSizer(orient=wx.HORIZONTAL)
        self.buttons_box.Add(item=auto_answer_button, proportion=CAN_NOT_CHANGE, flag=wx.LEFT | wx.RIGHT, border=5)

        self.Sizer.Add(item=self.buttons_box, proportion=CAN_NOT_CHANGE, flag=wx.TOP | wx.BOTTOM, border=5)

        menu = wx.Menu()
        menu_about = menu.Append(id=wx.ID_ABOUT, text=u"&??", help=u" ?????")
        menu_feedback = menu.Append(id=wx.ID_OPEN, text=u"&??", help=u" ??")
        self.Bind(event=wx.EVT_MENU, handler=self.show_about, source=menu_about)
        self.Bind(event=wx.EVT_MENU, handler=self.show_feedback, source=menu_feedback)
        menu_bar = wx.MenuBar()
        menu_bar.Append(menu, u"&??")
        self.SetMenuBar(menu_bar)
        self.statusbar = self.CreateStatusBar()
        self.Centre()
项目:bp5000    作者:isaiahr    | 项目源码 | 文件源码
def setup(self):
        menubar = wx.MenuBar()
        filem = wx.Menu()
        helpm = wx.Menu()
        setm = wx.Menu()
        new = filem.Append(wx.ID_NEW, '&New Tournament')
        open_ = filem.Append(wx.ID_OPEN, '&Open Tournament')
        filem.AppendSeparator()
        self.Bind(wx.EVT_MENU, self.new_event, new)
        qmi = wx.MenuItem(filem, wx.ID_EXIT, '&Quit\tCtrl+W')
        filem.AppendItem(qmi)
        about = helpm.Append(wx.ID_ANY, '&About BP5000')
        options = setm.Append(wx.ID_ANY, '&Options')
        self.Bind(wx.EVT_MENU, self.quit_event, qmi)
        self.Bind(wx.EVT_MENU, self.load_event, open_)
        self.Bind(wx.EVT_MENU, self.about_event, about)
        self.Bind(wx.EVT_MENU, self.options_event, options)
        self.options = Options()
        menubar.Append(filem, '&File')
        menubar.Append(setm, '&Settings')
        menubar.Append(helpm, '&Help')
        self.SetMenuBar(menubar)
        p = wx.Panel(self)
        self.nb = fnb.FlatNotebook(p, agwStyle=fnb.FNB_X_ON_TAB)

        def pagechanged(event):
            col = wx.Colour(hash(self.nb.GetPage(event.GetSelection()).sname))
            self.nb.SetActiveTabColour(col)
            if isinstance(self.nb.GetPage(event.GetSelection()), BracketPage):
                self.nb.GetPage(event.GetSelection()).updatebracketimg()

        self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, pagechanged)
        sz = wx.BoxSizer()
        sz.Add(self.nb, 1, wx.EXPAND)
        p.SetSizer(sz)
        self.Bind(wx.EVT_CLOSE, self.quit_event)
        self.SetSize((950, 650))
        self.SetTitle('BP5000')
        self.Centre()
        self.Show(True)
项目:Boms-Away    作者:Jeff-Ciesielski    | 项目源码 | 文件源码
def _create_menu(self):
        menubar = wx.MenuBar()
        file = wx.Menu()
        edit = wx.Menu()
        help = wx.Menu()

        file.Append(wx.ID_OPEN, '&Open', 'Open a schematic')
        file.Append(wx.ID_SAVE, '&Save', 'Save the schematic')
        file.AppendSeparator()
        file.Append(103, '&Export BOM as CSV', 'Export the BOM as CSV')
        file.AppendSeparator()

        # Create a new submenu for recent files
        recent = wx.Menu()

        file.AppendSubMenu(recent, 'Recent')
        self.filehistory.UseMenu(recent)
        self.filehistory.AddFilesToMenu()
        file.AppendSeparator()

        quit = wx.MenuItem(file, 105, '&Quit\tCtrl+Q', 'Quit the Application')
        file.AppendItem(quit)
        edit.Append(201, 'Consolidate Components', 'Consolidate duplicated components')
        menubar.Append(file, '&File')
        menubar.Append(edit, '&Edit')
        menubar.Append(help, '&Help')
        self.SetMenuBar(menubar)

        self.Bind(wx.EVT_MENU, self.on_quit, id=105)
        self.Bind(wx.EVT_MENU, self.on_open, id=wx.ID_OPEN)
        self.Bind(wx.EVT_MENU, self.on_consolidate, id=201)
        self.Bind(wx.EVT_MENU, self.on_export, id=103)
        self.Bind(wx.EVT_MENU, self.on_save, id=wx.ID_SAVE)
        self.Bind(wx.EVT_MENU_RANGE, self.on_file_history,
                  id=wx.ID_FILE1, id2=wx.ID_FILE9)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        self.filename = None
        super(LISImportFrame, self).__init__(*args, **kwargs)
        self.SetTitle('GRIPy LIS Loader')
        self.panel = wx.Panel(self)
        self.menu_bar = wx.MenuBar()
        file_menu = wx.Menu()
        file_menu.Append(wx.ID_OPEN, u"&Open LIS File")
        self.Bind(wx.EVT_MENU, self.on_open, id=wx.ID_OPEN)
        self.menu_bar.Append(file_menu, u"&File")
        self.SetMenuBar(self.menu_bar)
        self.status_bar = self.CreateStatusBar()
        self.model = None
        self.dvc = None
        self._OM = ObjectManager(self)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent):
        super(SearchDialog, self).__init__(parent=parent, title="pyjam Audio Search")
        self.parent = parent

        self.result_list = ObjectListView(parent=self, style=wx.LC_REPORT | wx.BORDER_SUNKEN, sortable=True,
                                          useAlternateBackColors=False)
        self.result_list.SetEmptyListMsg("No results")
        self.result_list.SetColumns([
            ColumnDefn(title="Title", valueGetter="title", width=150),
            ColumnDefn(title="Description", valueGetter="desc", width=300)
        ])

        self.search_recent = collections.deque([], 10)
        search_help = wx.StaticText(parent=self, label=("Enter a search term and press Enter. "
                                                        "Then, select the videos you want from the list and press OK."))
        self.search_query = wx.SearchCtrl(parent=self, style=wx.TE_PROCESS_ENTER)
        self.search_query.ShowCancelButton(True)
        self.search_query.SetMenu(self.search_menu())

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        olv_sizer = wx.BoxSizer(wx.VERTICAL)
        query_sizer = wx.BoxSizer(wx.VERTICAL)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        olv_sizer.Add(self.result_list, 1, wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ALIGN_TOP, 5)
        query_sizer.Add(search_help, 0, wx.ALL ^ wx.TOP, 5)
        query_sizer.Add(self.search_query, 0, wx.ALL ^ wx.TOP | wx.EXPAND, 5)
        top_sizer.Add(olv_sizer, 1, wx.ALL | wx.EXPAND, 5)
        top_sizer.Add(query_sizer, 0, wx.ALL | wx.EXPAND, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        # Context menu
        self.context_menu = wx.Menu()
        open_url = self.context_menu.Append(wx.ID_OPEN, "Open link in browser")
        copy_url = self.context_menu.Append(wx.ID_COPY, "Copy link address")

        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, handler=self.list_right_click, source=self.result_list)
        self.Bind(wx.EVT_MENU, handler=self.copy_url, source=copy_url)
        self.Bind(wx.EVT_MENU, handler=self.open_url, source=open_url)

        self.Bind(wx.EVT_TEXT_ENTER, handler=self.on_search, source=self.search_query)
        self.Bind(wx.EVT_BUTTON, handler=self.on_ok, id=wx.ID_OK)
        self.SetSizerAndFit(top_sizer)
        self.Center()
        self.ShowModal()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def _init_coll_FileMenu_Items(self, parent):
        AppendMenu(parent, help='', id=wx.ID_NEW,
                   kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N')
        AppendMenu(parent, help='', id=wx.ID_OPEN,
                   kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O')
        AppendMenu(parent, help='', id=wx.ID_CLOSE,
                   kind=wx.ITEM_NORMAL, text=_(u'Close Tab') + '\tCTRL+W')
        AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL,
                   kind=wx.ITEM_NORMAL, text=_(u'Close Project') + '\tCTRL+SHIFT+W')
        parent.AppendSeparator()
        AppendMenu(parent, help='', id=wx.ID_SAVE,
                   kind=wx.ITEM_NORMAL, text=_(u'Save') + '\tCTRL+S')
        AppendMenu(parent, help='', id=wx.ID_SAVEAS,
                   kind=wx.ITEM_NORMAL, text=_(u'Save As...') + '\tCTRL+SHIFT+S')
        AppendMenu(parent, help='', id=ID_PLCOPENEDITORFILEMENUGENERATE,
                   kind=wx.ITEM_NORMAL, text=_(u'Generate Program') + '\tCTRL+G')
        parent.AppendSeparator()
        AppendMenu(parent, help='', id=wx.ID_PAGE_SETUP,
                   kind=wx.ITEM_NORMAL, text=_(u'Page Setup') + '\tCTRL+ALT+P')
        AppendMenu(parent, help='', id=wx.ID_PREVIEW,
                   kind=wx.ITEM_NORMAL, text=_(u'Preview') + '\tCTRL+SHIFT+P')
        AppendMenu(parent, help='', id=wx.ID_PRINT,
                   kind=wx.ITEM_NORMAL, text=_(u'Print') + '\tCTRL+P')
        parent.AppendSeparator()
        AppendMenu(parent, help='', id=wx.ID_PROPERTIES,
                   kind=wx.ITEM_NORMAL, text=_(u'&Properties'))
        parent.AppendSeparator()
        AppendMenu(parent, help='', id=wx.ID_EXIT,
                   kind=wx.ITEM_NORMAL, text=_(u'Quit') + '\tCTRL+Q')

        self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW)
        self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN)
        self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE)
        self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu, id=wx.ID_CLOSE_ALL)
        self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
        self.Bind(wx.EVT_MENU, self.OnSaveProjectAsMenu, id=wx.ID_SAVEAS)
        self.Bind(wx.EVT_MENU, self.OnGenerateProgramMenu,
                  id=ID_PLCOPENEDITORFILEMENUGENERATE)
        self.Bind(wx.EVT_MENU, self.OnPageSetupMenu, id=wx.ID_PAGE_SETUP)
        self.Bind(wx.EVT_MENU, self.OnPreviewMenu, id=wx.ID_PREVIEW)
        self.Bind(wx.EVT_MENU, self.OnPrintMenu, id=wx.ID_PRINT)
        self.Bind(wx.EVT_MENU, self.OnPropertiesMenu, id=wx.ID_PROPERTIES)
        self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT)

        self.AddToMenuToolBar([(wx.ID_NEW, "new", _(u'New'), None),
                               (wx.ID_OPEN, "open", _(u'Open'), None),
                               (wx.ID_SAVE, "save", _(u'Save'), None),
                               (wx.ID_SAVEAS, "saveas", _(u'Save As...'), None),
                               (wx.ID_PRINT, "print", _(u'Print'), None)])