本文整理汇总了Python中tkinter.Menu.entryconfigure方法的典型用法代码示例。如果您正苦于以下问题:Python Menu.entryconfigure方法的具体用法?Python Menu.entryconfigure怎么用?Python Menu.entryconfigure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Menu
的用法示例。
在下文中一共展示了Menu.entryconfigure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QueryBrowserUI
# 需要导入模块: from tkinter import Menu [as 别名]
# 或者: from tkinter.Menu import entryconfigure [as 别名]
#.........这里部分代码省略.........
for n,table in enumerate(tables):
self.btnTables[table] = Button(self.pnlTableList, text=table,width=20, command=lambda cmd='QUERY',query='SELECT',table=table: self.onCommand(cmd,query=query,table=table))
self.btnTables[table].grid(row=n+1, column=1)
self.btnTables[table].bind("<Button-3>", lambda event, table=table:self.tableContextMenu(event, table))
if table == self.selectedTable:
self.markTable(table)
def onCommand(self, comando, **args):
comandos = {
'NEW':self.newDataBaseFile,
'OPEN':self.openDataBaseFile,
'EXIT':self.exitApp,
'ABOUT':self.about,
'QUERY':self.showQuery,
'RUN':self.run,
'TABLES_RL': self.showTablesAtRightOrLeft
}
try:
comandos[comando](**args)
except KeyError:
showerror(_('Error'), _('Unknown command: ')+ comando)
def exitApp(self):
self.destroy()
def about(self):
showinfo(_('About...'), self.appName+'\n'+_('Desarrollado por:')+'\n'+_('Martín Nicolás Carbone')+'\n'+_('Agosto 2014'))
def showTablesAtRightOrLeft(self):
self.tablesAtLeft = not self.tablesAtLeft
querySide, tablesSide = ("right", "left") if self.tablesAtLeft else ("left", "right")
self.pnlTables.pack(side=tablesSide, fill="both", pady=10, padx=10)
self.pnlQuery.pack(side=querySide, fill="both", expand=True, padx=10)
self.mnView.entryconfigure(0, label=_("Tables at %s") % _(querySide))
def selectTable(self, table):
self.unMarkTable(self.selectedTable)
self.selectedTable = table if table != '' else self.selectedTable
self.markTable(self.selectedTable)
return self.selectedTable
def unMarkTable(self, table):
try:
self.btnTables[table].config(relief='raised')
except KeyError:
pass
def markTable(self, table):
try:
self.btnTables[table].config(relief='sunken')
except KeyError:
pass
def newDataBaseFile(self):
path = asksaveasfilename(defaultextension=".db")
if path != '':
self.openDataBase(path)
def openDataBaseFile(self):
path = askopenfilename(filetypes=((_("Data base files"), "*.db;*.dat;*.sqlite;*.sqlite3;*.sql;"),(_("All files"), "*.*") ))
if path != '':
self.openDataBase(path)
def loadLastDataBaseFile(self):
path = self.readPath()
if path != '':
self.openDataBase(path)