本文整理汇总了Python中tkinter.NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.NORMAL属性的具体用法?Python tkinter.NORMAL怎么用?Python tkinter.NORMAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_modified
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def on_modified(self, event=None):
if not hasattr(self, "modifiedLabel"):
self.editor.edit_modified(False)
return
if self.editor.edit_modified():
text, mac, state = "MOD", True, tk.NORMAL
else:
text, mac, state = "", False, tk.DISABLED
self.modifiedLabel.config(text=text)
if TkUtil.mac():
self.master.attributes("-modified", mac)
self.fileMenu.entryconfigure(SAVE, state=state)
self.fileMenu.entryconfigure(SAVE_AS + ELLIPSIS, state=state)
self.saveButton.config(state=state)
self.editMenu.entryconfigure(UNDO, state=state)
self.undoButton.config(state=state)
示例2: config_frame_state
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def config_frame_state(frame, state):
"""
Changes the status property of a frame children.
"""
for child in frame.winfo_children():
# Only output_play_button can change output_stop_button's state
if child is output_stop_button:
# If output is playing right now
if play_event:
# Someone wants to disable the output frame, so output play must stop
play_event.set()
continue
child['state'] = state
# output_0_label's and output_to_label's cursor property are depending on their frame status
if frame is output_action_frame:
cursor = 'arrow'
if state == tkinter.NORMAL:
cursor = 'fleur'
output_0_label['cursor'] = cursor
output_to_label['cursor'] = cursor
示例3: calculation_stop
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def calculation_stop():
"""
Does some routine works that has to be done when to stop calculation.
"""
# Show start button
start_button.grid()
start_button_border_frame.grid()
# Hide progress bar
progress_bar.grid_remove()
progress_bar.stop()
stop_button['state'] = tkinter.DISABLED
# Re-enable menu bar buttons
menu_bar.entryconfig('Reload algorithms', state=tkinter.NORMAL)
menu_bar.entryconfig('Change goal state', state=tkinter.NORMAL)
n_spinbox['state'] = tkinter.NORMAL
# Enable input data entry
config_io_frame_state(input_labelframe, tkinter.NORMAL)
示例4: 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)
示例5: update_recent_files_menu
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def update_recent_files_menu(self):
if self.recentFiles:
menu = tk.Menu(self.fileMenu)
i = 1
for filename in self.recentFiles:
if filename != self.editor.filename:
menu.add_command(label="{}. {}".format(i, filename),
underline=0, command=lambda filename=filename:
self.load(filename))
i += 1
self.fileMenu.entryconfigure(OPEN_RECENT,
menu=menu)
self.fileMenu.entryconfigure(OPEN_RECENT,
state=tk.NORMAL if i > 1 else tk.DISABLED)
else:
self.fileMenu.entryconfigure(OPEN_RECENT,
state=tk.DISABLED)
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def __init__(self, parent, category, **kwargs):
super().__init__(parent, **kwargs)
self.category = category
self.price_input = lib.PriceInput(self,
font=self.font,
width=7,
conditional_bind=False)
self.price_input.configure(state=tk.NORMAL)
self.grid_columnconfigure(0, weight=1)
self.grid_columnconfigure(1, weight=1)
self.button = lib.MessageButton(self, text="Open Charge",
anchor=tk.W,
font=self.font,
relief=tk.RAISED,
bd=2)
self.button.command = self.add_item
self.button.grid(row=0, column=0, sticky="nswe")
self.price_input.grid(row=0, column=1, sticky="nswe")
示例7: radio_btn_change
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def radio_btn_change(self, name, *args):
''' Actions that happen when user clicks on a Radiobutton.
Changes the corresponding parameter values and options.
Args:
name (str): name of the parameter that is a key in
options dictionary.
*args: are provided by IntVar trace method and are
ignored in this method.
'''
count = self.options[name].get()
self.params.update_parameter(name, COUNT_TO_NAME_RADIO_BTN[name, count])
dea_form = COUNT_TO_NAME_RADIO_BTN[name, count]
if self.max_slack_box: # on creation it is None
if dea_form == 'multi':
# disable max slacks
self.max_slack_box.config(state=DISABLED)
self.params.update_parameter('MAXIMIZE_SLACKS', '')
elif dea_form == 'env':
self.max_slack_box.config(state=NORMAL)
if self.options['MAXIMIZE_SLACKS'].get() == 1:
self.params.update_parameter('MAXIMIZE_SLACKS', 'yes')
示例8: change_state_if_needed
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def change_state_if_needed(self, entry, entry_state, row, col):
''' Changes state of Checkbutton when data was modified depending on
the state of main_box.
Args:
entry (SelfValidatingEntry): Entry widget whose content
was modified.
entry_state (int): state of the Entry widget after content
modification, for possible values see dea_utils module.
row (int): row index of entry widget. It is the real grid
value, we need to subtract 2 to get internal index.
col (int): column index of entry widget. It is the real grid
value, we need to subtract 2 to get internal index.
'''
category_name = self.get_category()
if str(self.main_box.cget('state')) == DISABLED:
self.disable(col - 2, category_name)
else:
self.config(state=NORMAL)
if entry_state != CELL_DESTROY and self.var.get() == 1:
self.category_frame.add_category(category_name)
示例9: cargarPlayList
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def cargarPlayList(self):
self.vista.notebook.select(self.vista.tabPL)
self.disponibles = self.recursoPL['items']
self.vista.listPL.delete(0, END)
i = 0
texto_a_insertar = "{}) Título: {}, Duración: {}"
for s in self.disponibles:
i += 1
insertar = texto_a_insertar.format(i, s['pafy'].title[:40]+"...", s['pafy'].duration)
try:
self.vista.listPL.insert(END,insertar)
except TclError as e:
pass
self.vista.button.config(state=NORMAL)
self.vista.bvideo.config(state=NORMAL)
self.vista.baudio.config(state=NORMAL)
self.vista.bborrar.config(state=NORMAL)
self.vista.config(cursor="")
示例10: threaded_check_video
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def threaded_check_video(self):
self.last_row = 0
self.stream.set(0)
[radio_button.destroy() for radio_button in self.stream_widgets]
url = self.text_url.get()
if 'https' not in url:
url = 'https://www.youtube.com/watch?v=%s' % url
try:
if self.proxy.get() != '':
self.video = YouTube(url, proxies={self.proxy.get().split(':')[0]: self.proxy.get()})
else:
self.video = YouTube(url)
self.label_video_title['text'] = self.video.title
self.streams = self.video.streams.filter(only_audio=self.audio_only.get()).all()
for stream in self.streams:
if self.audio_only.get():
text = f'Codec: {stream.audio_codec}, ' \
f'ABR: {stream.abr} ' \
f'File Type: {stream.mime_type.split("/")[1]}, Size: {stream.filesize // 1024} KB'
else:
if stream.video_codec is None:
continue
text = f'Res: {stream.resolution}, FPS: {stream.fps},' \
f' Video Codec: {stream.video_codec}, Audio Codec: {stream.audio_codec}, ' \
f'File Type: {stream.mime_type.split("/")[1]}, Size: {stream.filesize // 1024} KB'
radio_button = tk.Radiobutton(self.frame, text=text, variable=self.stream, value=stream.itag)
self.last_row += 1
radio_button.grid(row=self.last_row, column=0, columnspan=4)
self.stream_widgets.append(radio_button)
except PytubeError as e:
messagebox.showerror('Something went wrong...', e)
except RegexMatchError as e:
messagebox.showerror('Something went wrong...', e)
finally:
self.btn_check_id['text'] = 'Check Video'
self.btn_check_id.config(state=tk.NORMAL)
示例11: training_task
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def training_task(self):
model_conf = ModelConfig(project_name=self.current_project)
self.current_task = Trains(model_conf)
try:
self.button_state(self.btn_training, tk.DISABLED)
self.button_state(self.btn_stop, tk.NORMAL)
self.is_task_running = True
self.current_task.train_process()
status = 'Training completed'
except Exception as e:
traceback.print_exc()
messagebox.showerror(
e.__class__.__name__, json.dumps(e.args, ensure_ascii=False)
)
status = 'Training failure'
self.button_state(self.btn_training, tk.NORMAL)
self.button_state(self.btn_stop, tk.DISABLED)
self.comb_project_name['state'] = tk.NORMAL
self.is_task_running = False
tk.messagebox.showinfo('Training Status', status)
示例12: update
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def update(self):
try:
self.text.config(state=tk.NORMAL)
while True:
action, param = self.queue.get_nowait()
if action == "append":
self.text.config(state=tk.NORMAL)
self.text.insert(tk.END, "\n")
self.text.insert(tk.END, param)
self.text.config(state=tk.DISABLED)
self.text.see(tk.END)
elif action == "die":
self.root.destroy()
self.root.quit()
return
except queue.Empty:
pass
self.text.after(100, self.update)
示例13: sign_in
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def sign_in(self, event=None):
"""
Note the `event` argument. This is required since this callback
may be called from a ``widget.bind`` (such as ``'<Return>'``),
which sends information about the event we don't care about.
This callback logs out if authorized, signs in if a code was
sent or a bot token is input, or sends the code otherwise.
"""
self.sign_in_label.configure(text='Working...')
self.sign_in_entry.configure(state=tkinter.DISABLED)
if await self.cl.is_user_authorized():
await self.cl.log_out()
self.destroy()
return
value = self.sign_in_entry.get().strip()
if self.code:
self.set_signed_in(await self.cl.sign_in(code=value))
elif ':' in value:
self.set_signed_in(await self.cl.sign_in(bot_token=value))
else:
self.code = await self.cl.send_code_request(value)
self.sign_in_label.configure(text='Code:')
self.sign_in_entry.configure(state=tkinter.NORMAL)
self.sign_in_entry.delete(0, tkinter.END)
self.sign_in_entry.focus()
return
示例14: set_signed_in
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def set_signed_in(self, me):
"""
Configures the application as "signed in" (displays user's
name and disables the entry to input phone/bot token/code).
"""
self.me = me
self.sign_in_label.configure(text='Signed in')
self.sign_in_entry.configure(state=tkinter.NORMAL)
self.sign_in_entry.delete(0, tkinter.END)
self.sign_in_entry.insert(tkinter.INSERT, utils.get_display_name(me))
self.sign_in_entry.configure(state=tkinter.DISABLED)
self.sign_in_button.configure(text='Log out')
self.chat.focus()
# noinspection PyUnusedLocal
示例15: update_logs_text_if_visible
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NORMAL [as 别名]
def update_logs_text_if_visible():
"""
If show logs window is open, then update the text widget's content.
If someone updates app logs, then should invoke this function.
"""
if logs_text:
logs_text['state'] = tkinter.NORMAL
logs_text.delete(0.0, tkinter.END)
logs_text.insert(0.0, ''.join(LOGS))
logs_text['state'] = tkinter.DISABLED
# Scroll to end of text
logs_text.see(tkinter.END)