Python wx.ID_EXIT Examples
The following are 24
code examples of wx.ID_EXIT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: Main.py From nodemcu-pyflasher with MIT License | 6 votes |
def _build_menu_bar(self): self.menuBar = wx.MenuBar() # File menu file_menu = wx.Menu() wx.App.SetMacExitMenuItemId(wx.ID_EXIT) exit_item = file_menu.Append(wx.ID_EXIT, "E&xit\tCtrl-Q", "Exit NodeMCU PyFlasher") exit_item.SetBitmap(images.Exit.GetBitmap()) self.Bind(wx.EVT_MENU, self._on_exit_app, exit_item) self.menuBar.Append(file_menu, "&File") # Help menu help_menu = wx.Menu() help_item = help_menu.Append(wx.ID_ABOUT, '&About NodeMCU PyFlasher', 'About') self.Bind(wx.EVT_MENU, self._on_help_about, help_item) self.menuBar.Append(help_menu, '&Help') self.SetMenuBar(self.menuBar)
Example #2
Source File: gui.py From four_flower with MIT License | 6 votes |
def makeMenuBar(self): fileMenu = wx.Menu() helloItem = fileMenu.Append(-1, "&Hello...\tCtrl-H", "Help string shown in status bar for this menu item") fileMenu.AppendSeparator() exitItem = fileMenu.Append(wx.ID_EXIT) helpMenu = wx.Menu() aboutItem = helpMenu.Append(wx.ID_ABOUT) menuBar = wx.MenuBar() menuBar.Append(fileMenu, "&File") menuBar.Append(helpMenu, "Help") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.OnHello, helloItem) self.Bind(wx.EVT_MENU, self.OnExit, exitItem) self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem)
Example #3
Source File: import_OpenGL_cube_and_cone.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
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
Example #4
Source File: wxPython_Wallpaper.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
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()
Example #5
Source File: wxPython_OpenGL_GUI.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
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()
Example #6
Source File: networkedit.py From CANFestivino with GNU Lesser General Public License v2.1 | 6 votes |
def _init_coll_FileMenu_Items(self, parent): parent.Append(help='', id=wx.ID_NEW, kind=wx.ITEM_NORMAL, text=_('New\tCTRL+N')) parent.Append(help='', id=wx.ID_OPEN, kind=wx.ITEM_NORMAL, text=_('Open\tCTRL+O')) parent.Append(help='', id=wx.ID_CLOSE, kind=wx.ITEM_NORMAL, text=_('Close\tCTRL+W')) parent.AppendSeparator() parent.Append(help='', id=wx.ID_SAVE, kind=wx.ITEM_NORMAL, text=_('Save\tCTRL+S')) parent.AppendSeparator() parent.Append(help='', id=wx.ID_EXIT, kind=wx.ITEM_NORMAL, text=_('Exit')) 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.OnCloseProjectMenu, id=wx.ID_CLOSE) self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE) self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT)
Example #7
Source File: gui.py From reading-frustum-pointnets-code with Apache License 2.0 | 6 votes |
def makeMenuBar(self): fileMenu = wx.Menu() helloItem = fileMenu.Append(-1, "&Hello...\tCtrl-H", "Help string shown in status bar for this menu item") fileMenu.AppendSeparator() exitItem = fileMenu.Append(wx.ID_EXIT) helpMenu = wx.Menu() aboutItem = helpMenu.Append(wx.ID_ABOUT) menuBar = wx.MenuBar() menuBar.Append(fileMenu, "&File") menuBar.Append(helpMenu, "Help") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.OnHello, helloItem) self.Bind(wx.EVT_MENU, self.OnExit, exitItem) self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem)
Example #8
Source File: wxPython_frame_GUI.py From Python-GUI-Programming-Cookbook-Third-Edition with MIT License | 5 votes |
def __init__(self, parent, title, size=(200,100)): # Initialize super class wx.Frame.__init__(self, parent, title=title, size=size) # Change the frame color self.SetBackgroundColour('white') # Create Status Bar self.CreateStatusBar() # Create the Menu menu= wx.Menu() # Add Menu Items to the Menu menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT,"Exit"," Exit the GUI") # Create the MenuBar menuBar = wx.MenuBar() # Give the Menu a Title menuBar.Append(menu,"File") # Connect the Menu to the frame self.SetMenuBar(menuBar) # Display the frame self.Show() # Create instance of wxPython application
Example #9
Source File: LanguageEditor.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def CreateMenuBar(self): # menu creation menuBar = wx.MenuBar() def AddMenuItem(name, func, itemId): menu.Append(itemId, name) self.Bind(wx.EVT_MENU, func, id=itemId) # file menu menu = wx.Menu() menuBar.Append(menu, "&File") AddMenuItem("&Open...\tCtrl+O", self.OnCmdOpen, wx.ID_OPEN) AddMenuItem("&Save\tCtrl+S", self.OnCmdSave, wx.ID_SAVE) menu.AppendSeparator() AddMenuItem("E&xit\tAlt+F4", self.OnCmdExit, wx.ID_EXIT) # edit menu menu = wx.Menu() menuBar.Append(menu, "&Edit") AddMenuItem("&Undo\tCtrl+Z", self.OnCmdUndo, wx.ID_UNDO) AddMenuItem("&Redo\tCtrl+Y", self.OnCmdRedo, wx.ID_REDO) menu.AppendSeparator() AddMenuItem("Cu&t\tCtrl+X", self.OnCmdCut, wx.ID_CUT) AddMenuItem("&Copy\tCtrl+C", self.OnCmdCopy, wx.ID_COPY) AddMenuItem("&Paste\tCtrl+V", self.OnCmdPaste, wx.ID_PASTE) AddMenuItem("&Delete", self.OnCmdDelete, wx.ID_DELETE) menu.AppendSeparator() AddMenuItem( "Find &Next Untranslated\tF3", self.OnCmdFindNext, wx.ID_FIND ) # help menu menu = wx.Menu() menuBar.Append(menu, "&Help") AddMenuItem("About Language Editor...", self.OnCmdAbout, wx.ID_ABOUT) self.SetMenuBar(menuBar) return menuBar
Example #10
Source File: archiveplayer.py From webarchiveplayer with GNU General Public License v3.0 | 5 votes |
def init_controls(self, contents=None, title=None, player_url=PLAYER_URL): self.menu_bar = wx.MenuBar() self.help_menu = wx.Menu() self.help_menu.Append(wx.ID_EXIT, "&QUIT") if wx.Platform != "__WXMAC__": self.menu_bar.Append(self.help_menu, "File") self.Bind(wx.EVT_MENU, self.quit, id=wx.ID_EXIT) self.SetMenuBar(self.menu_bar) self.html = wx.html.HtmlWindow(self) self.html.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.on_load_url) if not title: title = 'Web Archive Player ' + __version__ self.SetTitle(title) if not contents: contents = DEFAULT_HTML_PAGE contents = contents.format(version=__version__, pywb_version=pywb_version, player_url=player_url, info_url=INFO_URL) self.html.SetPage(contents) # set later self.archiveplayer = None
Example #11
Source File: objdictedit.py From CANFestivino with GNU Lesser General Public License v2.1 | 5 votes |
def _init_coll_FileMenu_Items(self, parent): parent.Append(help='', id=wx.ID_NEW, kind=wx.ITEM_NORMAL, text=_('New\tCTRL+N')) parent.Append(help='', id=wx.ID_OPEN, kind=wx.ITEM_NORMAL, text=_('Open\tCTRL+O')) parent.Append(help='', id=wx.ID_CLOSE, kind=wx.ITEM_NORMAL, text=_('Close\tCTRL+W')) parent.AppendSeparator() parent.Append(help='', id=wx.ID_SAVE, kind=wx.ITEM_NORMAL, text=_('Save\tCTRL+S')) parent.Append(help='', id=wx.ID_SAVEAS, kind=wx.ITEM_NORMAL, text=_('Save As...\tALT+S')) parent.AppendSeparator() parent.Append(help='', id=ID_OBJDICTEDITFILEMENUIMPORTEDS, kind=wx.ITEM_NORMAL, text=_('Import EDS file')) parent.Append(help='', id=ID_OBJDICTEDITFILEMENUEXPORTEDS, kind=wx.ITEM_NORMAL, text=_('Export to EDS file')) parent.Append(help='', id=ID_OBJDICTEDITFILEMENUEXPORTC, kind=wx.ITEM_NORMAL, text=_('Build Dictionary\tCTRL+B')) parent.AppendSeparator() parent.Append(help='', id=wx.ID_EXIT, kind=wx.ITEM_NORMAL, text=_('Exit')) self.Bind(wx.EVT_MENU, self.OnNewMenu, id=wx.ID_NEW) self.Bind(wx.EVT_MENU, self.OnOpenMenu, id=wx.ID_OPEN) self.Bind(wx.EVT_MENU, self.OnCloseMenu, id=wx.ID_CLOSE) self.Bind(wx.EVT_MENU, self.OnSaveMenu, id=wx.ID_SAVE) self.Bind(wx.EVT_MENU, self.OnSaveAsMenu, id=wx.ID_SAVEAS) self.Bind(wx.EVT_MENU, self.OnImportEDSMenu, id=ID_OBJDICTEDITFILEMENUIMPORTEDS) self.Bind(wx.EVT_MENU, self.OnExportEDSMenu, id=ID_OBJDICTEDITFILEMENUEXPORTEDS) self.Bind(wx.EVT_MENU, self.OnExportCMenu, id=ID_OBJDICTEDITFILEMENUEXPORTC) self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT)
Example #12
Source File: guicontrols.py From wfuzz with GNU General Public License v2.0 | 5 votes |
def start_gui(self, controller): self.controller = controller # tell FrameManager to manage this frame self._mgr = wx.aui.AuiManager() self._mgr.SetManagedWindow(self) # create menu mb = wx.MenuBar() file_menu = wx.Menu() file_menu.Append(wx.ID_EXIT, "Exit") help_menu = wx.Menu() help_menu.Append(ID_About, "About...") mb.Append(file_menu, "File") mb.Append(help_menu, "Help") self.SetMenuBar(mb) self.SetMinSize(wx.Size(400, 300)) # create some center panes self._mgr.AddPane(MainNotebookPanel(self, self, controller._interp), wx.aui.AuiPaneInfo().Caption("Raw HTTP Content").Name("analysis_notebook").CenterPane()) self._mgr.AddPane(self.CreateNotebook(), wx.aui.AuiPaneInfo().Name("main_notebook").CenterPane()) self._mgr.Update() self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_About) pub.subscribe(self.OnAddTab, "create_tab")
Example #13
Source File: chronolapse.py From chronolapse with MIT License | 5 votes |
def CreateMenu(self): self.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.ShowMenu) self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.toggle_window_visibility) self.Bind(wx.EVT_MENU, self.toggle_window_visibility, id=self.wx_id) self.Bind(wx.EVT_MENU, self.MainFrame.iconClose, id=wx.ID_EXIT) if ON_WINDOWS: self.MainFrame.Bind(wx.EVT_ICONIZE, self.set_window_visible_off) else: self.MainFrame.Bind(wx.EVT_ICONIZE, self.iconized) self.menu=wx.Menu() self.menu.Append(self.wx_id, "Minimize","...") self.menu.AppendSeparator() self.menu.Append(wx.ID_EXIT, "Close Chronolapse")
Example #14
Source File: GUI_wxPython.py From Python-GUI-Programming-Cookbook-Third-Edition with MIT License | 5 votes |
def createMenu(self): menu= wx.Menu() menu.Append(wx.ID_NEW, "New", "Create something new") menu.AppendSeparator() _exit = menu.Append(wx.ID_EXIT, "Exit", "Exit the GUI") self.Bind(wx.EVT_MENU, self.exitGUI, _exit) menuBar = wx.MenuBar() menuBar.Append(menu, "File") menu1= wx.Menu() menu1.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar.Append(menu1, "Help") self.SetMenuBar(menuBar) #----------------------------------------------------------
Example #15
Source File: ui.py From python-wifi-survey-heatmap with GNU Affero General Public License v3.0 | 5 votes |
def makeMenuBar(self): fileMenu = wx.Menu() fileMenu.AppendSeparator() exitItem = fileMenu.Append(wx.ID_EXIT) menuBar = wx.MenuBar() menuBar.Append(fileMenu, "&File") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.OnExit, exitItem)
Example #16
Source File: PyDraw.py From advancedpython3 with GNU General Public License v3.0 | 5 votes |
def command_menu_handler(self, command_event): id = command_event.GetId() if id == wx.ID_NEW: print('Clear the drawing area') self.clear_drawing() elif id == wx.ID_OPEN: print('Open a drawing file') elif id == wx.ID_SAVE: print('Save a drawing file') elif id == wx.ID_EXIT: print('Quite the application') self.view.Close() elif id == PyDrawConstants.LINE_ID: print('set drawing mode to line') self.set_line_mode() elif id == PyDrawConstants.SQUARE_ID: print('set drawing mode to square') self.set_square_mode() elif id == PyDrawConstants.CIRCLE_ID: print('set drawing mode to circle') self.set_circle_mode() elif id == PyDrawConstants.TEXT_ID: print('set drawing mode to Text') self.set_text_mode() else: print('Unknown option', id)
Example #17
Source File: PyDraw.py From advancedpython3 with GNU General Public License v3.0 | 5 votes |
def __init__(self): super().__init__() file_menu = wx.Menu() new_menu_item = wx.MenuItem(file_menu, wx.ID_NEW, text="New", kind=wx.ITEM_NORMAL) new_menu_item.SetBitmap(wx.Bitmap("new.gif")) file_menu.Append(new_menu_item) load_menu_item = wx.MenuItem(file_menu, wx.ID_OPEN, text="Open", kind=wx.ITEM_NORMAL) load_menu_item.SetBitmap(wx.Bitmap("load.gif")) file_menu.Append(load_menu_item) file_menu.AppendSeparator() save_menu_item = wx.MenuItem(file_menu, wx.ID_SAVE, text="Save", kind=wx.ITEM_NORMAL) save_menu_item.SetBitmap(wx.Bitmap("save.gif")) file_menu.Append(save_menu_item) file_menu.AppendSeparator() quit = wx.MenuItem(file_menu, wx.ID_EXIT, '&Quit\tCtrl+Q') file_menu.Append(quit) self.Append(file_menu, '&File') drawing_menu = wx.Menu() line_menu_item = wx.MenuItem(drawing_menu, PyDrawConstants.LINE_ID, text="Line", kind=wx.ITEM_NORMAL) drawing_menu.Append(line_menu_item) square_menu_item = wx.MenuItem(drawing_menu, PyDrawConstants.SQUARE_ID, text="Square", kind=wx.ITEM_NORMAL) drawing_menu.Append(square_menu_item) circle_menu_item = wx.MenuItem(drawing_menu, PyDrawConstants.CIRCLE_ID, text="Circle", kind=wx.ITEM_NORMAL) drawing_menu.Append(circle_menu_item) text_menu_item = wx.MenuItem(drawing_menu, PyDrawConstants.TEXT_ID, text="Text", kind=wx.ITEM_NORMAL) drawing_menu.Append(text_menu_item) self.Append(drawing_menu, '&Drawing')
Example #18
Source File: mathtext_wx_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, size=(550, 350)) self.figure = Figure() self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvas(self, -1, self.figure) self.change_plot(0) self.sizer = wx.BoxSizer(wx.VERTICAL) self.add_buttonbar() self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.add_toolbar() # comment this out for no toolbar menuBar = wx.MenuBar() # File Menu menu = wx.Menu() m_exit = menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") menuBar.Append(menu, "&File") self.Bind(wx.EVT_MENU, self.OnClose, m_exit) if IS_GTK or IS_WIN: # Equation Menu menu = wx.Menu() for i, (mt, func) in enumerate(functions): bm = mathtext_to_wxbitmap(mt) item = wx.MenuItem(menu, 1000 + i, " ") item.SetBitmap(bm) menu.Append(item) self.Bind(wx.EVT_MENU, self.OnChangePlot, item) menuBar.Append(menu, "&Functions") self.SetMenuBar(menuBar) self.SetSizer(self.sizer) self.Fit()
Example #19
Source File: ugrid_wx.py From gridded with The Unlicense | 5 votes |
def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.CreateStatusBar() MenuBar = wx.MenuBar() FileMenu = wx.Menu() item = FileMenu.Append(wx.ID_EXIT, text="&Exit") self.Bind(wx.EVT_MENU, self.OnQuit, item) item = FileMenu.Append(wx.ID_ANY, text="&Open") self.Bind(wx.EVT_MENU, self.OnOpen, item) item = FileMenu.Append(wx.ID_ANY, text="&Save Image") self.Bind(wx.EVT_MENU, self.OnSaveImage, item) MenuBar.Append(FileMenu, "&File") self.SetMenuBar(MenuBar) # Add the Canvas Canvas = NavCanvas.NavCanvas(self, -1, size=(500, 500), ProjectionFun=None, Debug=0, BackgroundColor=self.background_color, ).Canvas self.Canvas = Canvas FloatCanvas.EVT_MOTION(self.Canvas, self.OnMove) self.Show() Canvas.ZoomToBB()
Example #20
Source File: GUI_wxPython.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 5 votes |
def createMenu(self): menu= wx.Menu() menu.Append(wx.ID_NEW, "New", "Create something new") menu.AppendSeparator() _exit = menu.Append(wx.ID_EXIT, "Exit", "Exit the GUI") self.Bind(wx.EVT_MENU, self.exitGUI, _exit) menuBar = wx.MenuBar() menuBar.Append(menu, "File") menu1= wx.Menu() menu1.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar.Append(menu1, "Help") self.SetMenuBar(menuBar) #----------------------------------------------------------
Example #21
Source File: wxPython_frame_GUI.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 5 votes |
def __init__(self, parent, title, size=(200,100)): # Initialize super class wx.Frame.__init__(self, parent, title=title, size=size) # Change the frame color self.SetBackgroundColour('white') # Create Status Bar self.CreateStatusBar() # Create the Menu menu= wx.Menu() # Add Menu Items to the Menu menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menu.AppendSeparator() menu.Append(wx.ID_EXIT,"Exit"," Exit the GUI") # Create the MenuBar menuBar = wx.MenuBar() # Give the Menu a Title menuBar.Append(menu,"File") # Connect the Menu to the frame self.SetMenuBar(menuBar) # Display the frame self.Show() # Create instance of wxPython application
Example #22
Source File: gui-wx.py From filmkodi with Apache License 2.0 | 4 votes |
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(350, 200)) # Create the menubar menuBar = wx.MenuBar() # and a menu menu = wx.Menu() # add an item to the menu, using \tKeyName automatically # creates an accelerator, the third param is some help text # that will show up in the statusbar menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") # bind the menu event to an event handler self.Bind(wx.EVT_MENU, self.on_time_to_close, id=wx.ID_EXIT) # and put the menu on the menubar menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) self.CreateStatusBar() # Now create the Panel to put the other controls on. panel = wx.Panel(self) # and a few controls text = wx.StaticText(panel, -1, "Hello World!") text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) text.SetSize(text.GetBestSize()) btn = wx.Button(panel, -1, "Close") funbtn = wx.Button(panel, -1, "Just for fun...") # bind the button events to handlers self.Bind(wx.EVT_BUTTON, self.on_time_to_close, btn) self.Bind(wx.EVT_BUTTON, self.on_fun_button, funbtn) # Use a sizer to layout the controls, stacked vertically and with # a 10 pixel border around each sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(text, 0, wx.ALL, 10) sizer.Add(btn, 0, wx.ALL, 10) sizer.Add(funbtn, 0, wx.ALL, 10) panel.SetSizer(sizer) panel.Layout()
Example #23
Source File: gui-wx.py From PyDev.Debugger with Eclipse Public License 1.0 | 4 votes |
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(350, 200)) # Create the menubar menuBar = wx.MenuBar() # and a menu menu = wx.Menu() # add an item to the menu, using \tKeyName automatically # creates an accelerator, the third param is some help text # that will show up in the statusbar menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample") # bind the menu event to an event handler self.Bind(wx.EVT_MENU, self.on_time_to_close, id=wx.ID_EXIT) # and put the menu on the menubar menuBar.Append(menu, "&File") self.SetMenuBar(menuBar) self.CreateStatusBar() # Now create the Panel to put the other controls on. panel = wx.Panel(self) # and a few controls text = wx.StaticText(panel, -1, "Hello World!") text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) text.SetSize(text.GetBestSize()) btn = wx.Button(panel, -1, "Close") funbtn = wx.Button(panel, -1, "Just for fun...") # bind the button events to handlers self.Bind(wx.EVT_BUTTON, self.on_time_to_close, btn) self.Bind(wx.EVT_BUTTON, self.on_fun_button, funbtn) # Use a sizer to layout the controls, stacked vertically and with # a 10 pixel border around each sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(text, 0, wx.ALL, 10) sizer.Add(btn, 0, wx.ALL, 10) sizer.Add(funbtn, 0, wx.ALL, 10) panel.SetSizer(sizer) panel.Layout()
Example #24
Source File: PLCOpenEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
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') AppendMenu(parent, help='', id=ID_PLCOPENEDITORFILEMENUGENERATEAS, kind=wx.ITEM_NORMAL, text=_(u'Generate Program As...') + '\tCTRL+SHIFT+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.OnGenerateProgramAsMenu, id=ID_PLCOPENEDITORFILEMENUGENERATEAS) 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), (ID_PLCOPENEDITORFILEMENUGENERATE, "Build", _(u'Generate Program'), None)])