本文整理汇总了Python中wx.ID_NEW属性的典型用法代码示例。如果您正苦于以下问题:Python wx.ID_NEW属性的具体用法?Python wx.ID_NEW怎么用?Python wx.ID_NEW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.ID_NEW属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_coll_FileMenu_Items
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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)
示例2: createMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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)
#----------------------------------------------------------
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:15,代码来源:GUI_wxPython.py
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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')
示例4: command_menu_handler
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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)
示例5: suggestionCandidates
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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
示例6: suggestionCandidates
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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
示例7: suggestionCandidates
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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
示例8: _init_coll_FileMenu_Items
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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)
示例9: create_toolbar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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()
示例10: _init_coll_FileMenu_Items
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ID_NEW [as 别名]
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)])