Python wx.ID_NEW Examples
The following are 12
code examples of wx.ID_NEW().
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: 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 #2
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 #3
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 #4
Source File: PyDraw.py From advancedpython3 with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent): super().__init__(parent) self.AddTool(toolId=wx.ID_NEW, label="New", bitmap=wx.Bitmap("new.gif"), shortHelp='Open drawing', kind=wx.ITEM_NORMAL) self.AddTool(toolId=wx.ID_OPEN, label="Open", bitmap=wx.Bitmap("load.gif"), shortHelp='Open drawing', kind=wx.ITEM_NORMAL) self.AddTool(toolId=wx.ID_SAVE, label="Save", bitmap=wx.Bitmap("save.gif"), shortHelp='Save drawing', kind=wx.ITEM_NORMAL) self.Realize()
Example #5
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 #6
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 #7
Source File: backupTerminalFrontEnd.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def suggestionCandidates(self, searchString): qry = 'SELECT products.name, products.codeName, products.costPrice, products.sellingPrice, products.barcode FROM `currentinventory`, `products` WHERE products.id = currentinventory.productId AND codeName LIKE "%' + str( searchString) + '%"' conn = connectToDB() curs = conn.cursor() curs.execute(qry) r = curs.fetchall() menu = wx.Menu() for x in r: help = "Rs. " + str(x['costPrice']) + " Rs. " + str(x['sellingPrice']) + " " + str(x['barcode']) menu.Append(wx.ID_NEW, x['codeName'], helpString=help) return menu
Example #8
Source File: terminalFrontEnd.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def suggestionCandidates (self, searchString): qry = 'SELECT products.name, products.codeName, products.costPrice, products.sellingPrice, products.barcode FROM `currentinventory`, `products` WHERE products.id = currentinventory.productId AND codeName LIKE "%'+str(searchString)+'%"' conn = connectToDB() curs = conn.cursor() curs.execute(qry) r = curs.fetchall() menu = wx.Menu() for x in r: help = "Rs. " + str(x['costPrice']) + " Rs. " + str(x['sellingPrice']) + " " + str(x['barcode']) menu.Append(wx.ID_NEW, x['codeName'], helpString=help) return menu
Example #9
Source File: terminalFrontEnd.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def suggestionCandidates (self, searchString): qry = 'SELECT products.name, products.codeName, products.costPrice, products.sellingPrice, products.barcode FROM `currentinventory`, `products` WHERE products.id = currentinventory.productId AND codeName LIKE "%'+str(searchString)+'%"' conn = connectToDB() curs = conn.cursor() curs.execute(qry) r = curs.fetchall() menu = wx.Menu() for x in r: help = "Rs. " + str(x['costPrice']) + " Rs. " + str(x['sellingPrice']) + " " + str(x['barcode']) menu.Append(wx.ID_NEW, x['codeName'], helpString=help) return menu
Example #10
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 #11
Source File: main.py From wxGlade with MIT License | 4 votes |
def create_toolbar(self): # new, open, save, generate, add, delete, re-do, Layout 1, 2, 3, pin, help # insert slot/page? # Layout: Alt + 1,2,3 self.toolbar = tb = wx.ToolBar(self, -1) self.SetToolBar(tb) size = (21,21) add = functools.partial(self._add_label_tool, tb, size) t = add( wx.ID_NEW, "New", wx.ART_NEW, wx.ITEM_NORMAL, "Open a new file (Ctrl+N)") self.Bind(wx.EVT_TOOL, self.new_app, t) t = add( wx.ID_OPEN, "Open", wx.ART_FILE_OPEN, wx.ITEM_NORMAL, "Open a file (Ctrl+O)") self.Bind(wx.EVT_TOOL, self.open_app, t) t = add( wx.ID_SAVE, "Save", wx.ART_FILE_SAVE, wx.ITEM_NORMAL, "Save file (Ctrl+S)") self.Bind(wx.EVT_TOOL, self.save_app, t) if config.debugging and hasattr(wx, "ART_PLUS"): t = add( wx.ID_SAVE, "Add", wx.ART_PLUS, wx.ITEM_NORMAL, "Add widget (Ctrl+A)") t.Enable(False) # XXX switch between wx.ART_DELETE for filled slots and wx.ART_MINUS for empty slots t = add( wx.ID_SAVE, "Remove", wx.ART_MINUS, wx.ITEM_NORMAL, "Add widget (Ctrl+A)") t.Enable(False) tb.AddSeparator() self._tool_redo = t = add( wx.ID_SAVE, "Re-do", wx.ART_REDO, wx.ITEM_NORMAL, "Re-do (Ctrl+Y)" ) t.Enable(False) self._tool_repeat = t = add( wx.ID_SAVE, "Repeat", wx.ART_REDO, wx.ITEM_NORMAL, "Repeat (Ctrl+R)" ) t.Enable(False) tb.AddSeparator() t = add(-1, "Generate Code", wx.ART_EXECUTABLE_FILE, wx.ITEM_NORMAL, "Generate Code (Ctrl+G)" ) self.Bind(wx.EVT_TOOL, lambda event: common.root.generate_code(), t) tb.AddSeparator() t1 = add(-1, "Layout 1", "layout1.xpm", wx.ITEM_RADIO, "Switch layout: Tree", "Switch layout: Palette and Properties left, Tree right") self.Bind(wx.EVT_TOOL, lambda event: self.switch_layout(0), t1) t2 = add(-1, "Layout 2", "layout2.xpm", wx.ITEM_RADIO,"Switch layout: Properties", "Switch layout: Palette and Tree top, Properties bottom") self.Bind(wx.EVT_TOOL, lambda event: self.switch_layout(1), t2) t3 = add(-1, "Layout 3", "layout3.xpm", wx.ITEM_RADIO, "Switch layout: narrow", "Switch layout: Palette, Tree and Properties on top of each other") self.Bind(wx.EVT_TOOL, lambda event: self.switch_layout(2), t3) self._layout_tools = [t1,t2,t3] tb.AddSeparator() t = add(-1, "Pin Design Window", "pin_design.xpm", wx.ITEM_CHECK, "Pin Design Window", "Pin Design Window to stay on top") self.Bind(wx.EVT_TOOL, lambda event: self.pin_design_window(), t) self._t_pin_design_window = t tb.AddSeparator() t = add(wx.ID_HELP, "Help", wx.ART_HELP_BOOK, wx.ITEM_NORMAL, "Show manual (F1)") self.Bind(wx.EVT_TOOL, self.show_manual, t) self.toolbar.Realize()
Example #12
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)])