本文整理匯總了Python中Tkinter.NORMAL屬性的典型用法代碼示例。如果您正苦於以下問題:Python Tkinter.NORMAL屬性的具體用法?Python Tkinter.NORMAL怎麽用?Python Tkinter.NORMAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類Tkinter
的用法示例。
在下文中一共展示了Tkinter.NORMAL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: auth
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def auth(self, event=None):
try:
companion.session.auth_callback()
self.status['text'] = _('Authentication successful') # Successfully authenticated with the Frontier website
if platform == 'darwin':
self.view_menu.entryconfigure(0, state=tk.NORMAL) # Status
self.file_menu.entryconfigure(0, state=tk.NORMAL) # Save Raw Data
else:
self.file_menu.entryconfigure(0, state=tk.NORMAL) # Status
self.file_menu.entryconfigure(1, state=tk.NORMAL) # Save Raw Data
except companion.ServerError as e:
self.status['text'] = unicode(e)
except Exception as e:
if __debug__: print_exc()
self.status['text'] = unicode(e)
self.cooldown()
# Handle Status event
示例2: load_pipeline
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def load_pipeline(self, event=None):
top = tkinter.Toplevel()
master_selector = SemTkMasterSelector(top, os.path.join(sem.SEM_DATA_DIR, "resources"))
lang_selector = SemTkLangSelector(top, os.path.join(sem.SEM_DATA_DIR, "resources"))
lang_selector.master_selector = master_selector
vars_cur_row = 0
vars_cur_row, _ = lang_selector.grid(row=vars_cur_row, column=0)
vars_cur_row, _ = master_selector.grid(row=vars_cur_row, column=0)
def cancel(event=None):
if self.pipeline is not None:
self.tag_document_btn.configure(state=tkinter.NORMAL)
top.destroy()
def ok(event=None):
path = master_selector.workflow()
pipeline, _, _, _ = sem.modules.tagger.load_master(path)
self.pipeline = pipeline
cancel()
ok_btn = ttk.Button(top, text="load workflow", command=ok)
ok_btn.grid(row=vars_cur_row, column=0)
cancel_btn = ttk.Button(top, text="cancel", command=cancel)
cancel_btn.grid(row=vars_cur_row, column=1)
示例3: load_listbox_click
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def load_listbox_click(self,*event):
if self.load_listbox.size()==0:
pass
else:
self.b_change_load.configure(state=tk.NORMAL, bg='yellow2')
self.b_remove_load.configure(state=tk.NORMAL, bg='red3')
self.selected_load = self.load_listbox.get(self.load_listbox.curselection()[0]).split(',')
self.load_change_index = self.load_listbox.curselection()[0]
self.load_span_select.set(self.selected_load[0])
self.w1_gui.set(self.selected_load[1])
self.w2_gui.set(self.selected_load[2])
self.a_gui.set(self.selected_load[3])
self.b_gui.set(self.selected_load[4])
self.load_type.set(self.selected_load[5])
self.load_kind_select.set(self.selected_load[6])
示例4: LoadAnalysisFromPath
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def LoadAnalysisFromPath(self, fileName):
try:
preferences = Preferences.get()
preferences.analysisLastOpened = fileName
preferences.save()
except ExceptionHandler.ExceptionType as e:
ExceptionHandler.add(e, "Cannot save preferences")
self.analysisFilePathTextBox.config(state=tk.NORMAL)
self.analysisFilePathTextBox.delete(0, tk.END)
self.analysisFilePathTextBox.insert(0, fileName)
self.analysisFilePathTextBox.config(state=tk.DISABLED)
self.analysis = None
self.analysisConfiguration = None
if len(fileName) > 0:
try:
self.analysisConfiguration = AnalysisConfiguration(fileName)
Status.add("Analysis config loaded: %s" % fileName)
except ExceptionHandler.ExceptionType as e:
ExceptionHandler.add(e, "ERROR loading config")
示例5: login
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def login(self):
if not self.status['text']:
self.status['text'] = _('Logging in...')
self.button['state'] = self.theme_button['state'] = tk.DISABLED
if platform == 'darwin':
self.view_menu.entryconfigure(0, state=tk.DISABLED) # Status
self.file_menu.entryconfigure(0, state=tk.DISABLED) # Save Raw Data
else:
self.file_menu.entryconfigure(0, state=tk.DISABLED) # Status
self.file_menu.entryconfigure(1, state=tk.DISABLED) # Save Raw Data
self.w.update_idletasks()
try:
if companion.session.login(monitor.cmdr, monitor.is_beta):
self.status['text'] = _('Authentication successful') # Successfully authenticated with the Frontier website
if platform == 'darwin':
self.view_menu.entryconfigure(0, state=tk.NORMAL) # Status
self.file_menu.entryconfigure(0, state=tk.NORMAL) # Save Raw Data
else:
self.file_menu.entryconfigure(0, state=tk.NORMAL) # Status
self.file_menu.entryconfigure(1, state=tk.NORMAL) # Save Raw Data
except (companion.CredentialsError, companion.ServerError, companion.ServerLagging) as e:
self.status['text'] = unicode(e)
except Exception as e:
if __debug__: print_exc()
self.status['text'] = unicode(e)
self.cooldown()
示例6: cooldown
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def cooldown(self):
if time() < self.holdofftime:
self.button['text'] = self.theme_button['text'] = _('cooldown {SS}s').format(SS = int(self.holdofftime - time())) # Update button in main window
self.w.after(1000, self.cooldown)
else:
self.button['text'] = self.theme_button['text'] = _('Update') # Update button in main window
self.button['state'] = self.theme_button['state'] = (monitor.cmdr and
monitor.mode and
not monitor.state['Captain'] and
monitor.system and
tk.NORMAL or tk.DISABLED)
示例7: outvarchanged
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def outvarchanged(self, event=None):
self.displaypath(self.outdir, self.outdir_entry)
self.displaypath(self.logdir, self.logdir_entry)
logdir = self.logdir.get()
logvalid = logdir and exists(logdir)
self.out_label['state'] = self.out_csv_button['state'] = self.out_td_button['state'] = self.out_ship_button['state'] = tk.NORMAL or tk.DISABLED
local = self.out_td.get() or self.out_csv.get() or self.out_ship.get()
self.out_auto_button['state'] = local and logvalid and tk.NORMAL or tk.DISABLED
self.outdir_label['state'] = local and tk.NORMAL or tk.DISABLED
self.outbutton['state'] = local and tk.NORMAL or tk.DISABLED
self.outdir_entry['state'] = local and 'readonly' or tk.DISABLED
示例8: displaypath
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def displaypath(self, pathvar, entryfield):
entryfield['state'] = tk.NORMAL # must be writable to update
entryfield.delete(0, tk.END)
if platform=='win32':
start = pathvar.get().lower().startswith(config.home.lower()) and len(config.home.split('\\')) or 0
display = []
components = normpath(pathvar.get()).split('\\')
buf = ctypes.create_unicode_buffer(MAX_PATH)
pidsRes = ctypes.c_int()
for i in range(start, len(components)):
try:
if (not SHGetLocalizedName('\\'.join(components[:i+1]), buf, MAX_PATH, ctypes.byref(pidsRes)) and
LoadString(ctypes.WinDLL(expandvars(buf.value))._handle, pidsRes.value, buf, MAX_PATH)):
display.append(buf.value)
else:
display.append(components[i])
except:
display.append(components[i])
entryfield.insert(0, '\\'.join(display))
elif platform=='darwin' and NSFileManager.defaultManager().componentsToDisplayForPath_(pathvar.get()): # None if path doesn't exist
if pathvar.get().startswith(config.home):
display = ['~'] + NSFileManager.defaultManager().componentsToDisplayForPath_(pathvar.get())[len(NSFileManager.defaultManager().componentsToDisplayForPath_(config.home)):]
else:
display = NSFileManager.defaultManager().componentsToDisplayForPath_(pathvar.get())
entryfield.insert(0, '/'.join(display))
else:
if pathvar.get().startswith(config.home):
entryfield.insert(0, '~' + pathvar.get()[len(config.home):])
else:
entryfield.insert(0, pathvar.get())
entryfield['state'] = 'readonly'
示例9: hotkeylisten
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def hotkeylisten(self, event):
good = hotkeymgr.fromevent(event)
if good:
(hotkey_code, hotkey_mods) = good
event.widget.delete(0, tk.END)
event.widget.insert(0, hotkeymgr.display(hotkey_code, hotkey_mods))
if hotkey_code:
# done
(self.hotkey_code, self.hotkey_mods) = (hotkey_code, hotkey_mods)
self.hotkey_only_btn['state'] = tk.NORMAL
self.hotkey_play_btn['state'] = tk.NORMAL
self.hotkey_only_btn.focus() # move to next widget - calls hotkeyend() implicitly
else:
if good is None: # clear
(self.hotkey_code, self.hotkey_mods) = (0, 0)
event.widget.delete(0, tk.END)
if self.hotkey_code:
event.widget.insert(0, hotkeymgr.display(self.hotkey_code, self.hotkey_mods))
self.hotkey_only_btn['state'] = tk.NORMAL
self.hotkey_play_btn['state'] = tk.NORMAL
else:
event.widget.insert(0, _('None')) # No hotkey/shortcut currently defined
self.hotkey_only_btn['state'] = tk.DISABLED
self.hotkey_play_btn['state'] = tk.DISABLED
self.hotkey_only_btn.focus() # move to next widget - calls hotkeyend() implicitly
return('break') # stops further processing - insertion, Tab traversal etc
示例10: _leave
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def _leave(self, event, image):
widget = event.widget
if widget and widget['state'] != tk.DISABLED:
widget.configure(state = tk.NORMAL)
if image:
image.configure(foreground = self.current['foreground'], background = self.current['background'])
# Set up colors
示例11: __init__
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def __init__(self, master=None, **kw):
self.url = 'url' in kw and kw.pop('url') or None
self.popup_copy = kw.pop('popup_copy', False)
self.underline = kw.pop('underline', None) # override ttk.Label's underline
self.foreground = kw.get('foreground') or 'blue'
self.disabledforeground = kw.pop('disabledforeground', ttk.Style().lookup('TLabel', 'foreground', ('disabled',))) # ttk.Label doesn't support disabledforeground option
if platform == 'darwin':
# Use tk.Label 'cos can't set ttk.Label background - http://www.tkdocs.com/tutorial/styles.html#whydifficult
kw['background'] = kw.pop('background', 'systemDialogBackgroundActive')
kw['anchor'] = kw.pop('anchor', tk.W) # like ttk.Label
tk.Label.__init__(self, master, **kw)
else:
ttk.Label.__init__(self, master, **kw)
self.bind('<Button-1>', self._click)
self.menu = tk.Menu(None, tearoff=tk.FALSE)
self.menu.add_command(label=_('Copy'), command = self.copy) # As in Copy and Paste
self.bind(platform == 'darwin' and '<Button-2>' or '<Button-3>', self._contextmenu)
self.bind('<Enter>', self._enter)
self.bind('<Leave>', self._leave)
# set up initial appearance
self.configure(state = kw.get('state', tk.NORMAL),
text = kw.get('text'),
font = kw.get('font', ttk.Style().lookup('TLabel', 'font')))
# Change cursor and appearance depending on state and text
示例12: prefs_cmdr_changed
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def prefs_cmdr_changed(cmdr, is_beta):
this.log_button['state'] = cmdr and not is_beta and tk.NORMAL or tk.DISABLED
this.apikey['state'] = tk.NORMAL
this.apikey.delete(0, tk.END)
if cmdr:
cred = credentials(cmdr)
if cred:
this.apikey.insert(0, cred)
this.label['state'] = this.apikey_label['state'] = this.apikey['state'] = cmdr and not is_beta and this.log.get() and tk.NORMAL or tk.DISABLED
示例13: prefs_cmdr_changed
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def prefs_cmdr_changed(cmdr, is_beta):
this.log_button['state'] = cmdr and not is_beta and tk.NORMAL or tk.DISABLED
this.user['state'] = tk.NORMAL
this.user.delete(0, tk.END)
this.apikey['state'] = tk.NORMAL
this.apikey.delete(0, tk.END)
if cmdr:
this.cmdr_text['text'] = cmdr + (is_beta and ' [Beta]' or '')
cred = credentials(cmdr)
if cred:
this.user.insert(0, cred[0])
this.apikey.insert(0, cred[1])
else:
this.cmdr_text['text'] = _('None') # No hotkey/shortcut currently defined
this.label['state'] = this.cmdr_label['state'] = this.cmdr_text['state'] = this.user_label['state'] = this.user['state'] = this.apikey_label['state'] = this.apikey['state'] = cmdr and not is_beta and this.log.get() and tk.NORMAL or tk.DISABLED
示例14: check
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def check(self):
"""Method to chack that Lotus Notes COM interface is loaded"""
if self.Lotus != None:
self.checked = True
self.log(ErrorLevel.NORMAL, _("Connection to Notes established\n"))
else:
self.unchecked()
self.log(ErrorLevel.ERROR, _("Check the Notes password and that NSF2X and Notes use the same architecture\n"))
return self.checked
示例15: configStop
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import NORMAL [as 別名]
def configStop(self, AllowButton=True, ActionText=_("Stop")):
"""Gui Stop Button Configuration"""
self.chooseNsfButton.config(state=tkinter.DISABLED)
self.chooseDestButton.config(state=tkinter.DISABLED)
self.entryPassword.config(state=tkinter.DISABLED)
if AllowButton:
self.startButton.config(text=ActionText, state=tkinter.NORMAL)
else:
self.startButton.config(text=ActionText, state=tkinter.DISABLED)
self.optionsButton.config(state=tkinter.DISABLED)
self.formatTypeEML.config(state=tkinter.DISABLED)
self.formatTypeMBOX.config(state=tkinter.DISABLED)
self.formatTypePST.config(state=tkinter.DISABLED)