本文整理汇总了Python中tkinter.SE属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.SE属性的具体用法?Python tkinter.SE怎么用?Python tkinter.SE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.SE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_bulb_icon
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def draw_bulb_icon(self, bulb, label):
""" Given a bulb and a name, add the icon to the end of the row. """
# Make room on canvas
self.scrollx += self.icon_width
self.canvas.configure(scrollregion=(0, 0, self.scrollx, self.scrolly))
# Build icon
path = self.icon_path()
sprite = tkinter.PhotoImage(file=path, master=self.master)
image = self.canvas.create_image(
(self.current_icon_width + self.icon_width - self.pad, self.icon_height / 2 + 2 * self.pad), image=sprite,
anchor=tkinter.SE, tags=[label])
text = self.canvas.create_text(self.current_icon_width + self.pad / 2, self.icon_height / 2 + 2 * self.pad,
text=label[:8], anchor=tkinter.NW, tags=[label])
self.bulb_dict[label] = (sprite, image, text)
self.update_icon(bulb)
# update sizing info
self.current_icon_width += self.icon_width
示例2: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.chan_num != -1:
self.results_group = tk.LabelFrame(
self, text="Results", padx=3, pady=3)
self.results_group.pack(
fill=tk.X, anchor=tk.NW, padx=3, pady=3)
self.data_frame = tk.Frame(self.results_group)
self.data_frame.grid()
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
self.start_button = tk.Button(button_frame)
self.start_button["text"] = "Start"
self.start_button["command"] = self.start
self.start_button.grid(row=0, column=0, padx=3, pady=3)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例3: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.port != None:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
curr_row = 0
raw_value_left_label = tk.Label(main_frame)
raw_value_left_label["text"] = (
self.port.type.name + " bit " + str(self.port.first_bit)
+ " value read:")
raw_value_left_label.grid(row=curr_row, column=0, sticky=tk.W)
self.value_label = tk.Label(main_frame)
self.value_label.grid(row=curr_row, column=1, sticky=tk.W)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
self.start_button = tk.Button(button_frame)
self.start_button["text"] = "Start"
self.start_button["command"] = self.start
self.start_button.grid(row=0, column=0, padx=3, pady=3)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例4: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.port != None:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
curr_row = 0
bit_values_frame = tk.Frame(main_frame)
bit_values_frame.grid(row=curr_row, column=0, padx=3, pady=3)
label = tk.Label(bit_values_frame, text="Bit Number:")
label.grid(row=0, column=0, sticky=tk.W)
label = tk.Label(bit_values_frame, text="State:")
label.grid(row=1, column=0, sticky=tk.W)
# Create Checkbutton controls for each bit
self.bit_checkbutton_vars = []
max_bit = min(self.port.num_bits, 8)
for bit_num in range(0, max_bit):
bit_label = tk.Label(bit_values_frame, text=str(bit_num))
bit_label.grid(row=0, column=bit_num + 1)
var = IntVar(value=-1)
bit_checkbutton = tk.Checkbutton(
bit_values_frame, tristatevalue=-1, variable=var,
borderwidth=0,
command=lambda n=bit_num:
self.bit_checkbutton_changed(n))
bit_checkbutton.grid(row=1, column=bit_num + 1, padx=(5, 0))
self.bit_checkbutton_vars.append(var)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.exit
quit_button.grid(row=0, column=0, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例5: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.chan_num != -1:
info_text = tk.Label(self)
info_text["text"] = (
"Encoder scan on device " + str(self.board_num)
+ " counter channel " + str(self.chan_num))
info_text.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3)
results_group = tk.LabelFrame(self, text="Results")
results_group.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3)
self.data_label = tk.Label(results_group, justify=tk.LEFT)
self.data_label.grid(padx=3, pady=3)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
self.start_button = tk.Button(button_frame)
self.start_button["text"] = "Start"
self.start_button["command"] = self.start
self.start_button.grid(row=0, column=0, padx=3, pady=3)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
# Start the example if this module is being run
示例6: create_unsupported_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_unsupported_widgets(self, board_num):
incompatible_label = tk.Label(self, fg="red")
incompatible_label["text"] = (
"Board " + str(board_num)
+ " was not found or is not compatible with this example.")
incompatible_label.pack(fill=tk.X, side=tk.LEFT, anchor=tk.NW)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=0, padx=3, pady=3)
示例7: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
positive_int_vcmd = self.register(self.validate_positive_int_entry)
board_num_label = tk.Label(main_frame)
board_num_label["text"] = "Board Number:"
board_num_label.grid(row=0, column=0, sticky=tk.W)
self.board_num_variable = StringVar()
board_num_entry = tk.Spinbox(
main_frame, from_=0, to=self.max_board_num,
textvariable=self.board_num_variable,
validate="key", validatecommand=(positive_int_vcmd, "%P"))
board_num_entry.grid(row=0, column=1, sticky=tk.W)
self.board_num_variable.trace("w", self.board_num_changed)
info_groupbox = tk.LabelFrame(self, text="Board Information")
info_groupbox.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3)
self.info_label = tk.Label(
info_groupbox, justify=tk.LEFT, wraplength=400)
self.info_label.grid()
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=0, padx=3, pady=3)
# Start the example if this module is being run
示例8: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
positive_int_vcmd = self.register(self.validate_positive_int_entry)
err_code_label = tk.Label(main_frame)
err_code_label["text"] = "Error Code:"
err_code_label.grid(row=0, column=0, sticky=tk.W)
self.err_code_variable = StringVar(0)
self.err_code_entry = tk.Spinbox(
main_frame, from_=0, to=2000,
textvariable=self.err_code_variable,
validate="key", validatecommand=(positive_int_vcmd, "%P"))
self.err_code_entry.grid(row=0, column=1, sticky=tk.W)
self.err_code_variable.trace("w", self.err_code_changed)
err_msg_left_label = tk.Label(main_frame)
err_msg_left_label["text"] = "Message:"
err_msg_left_label.grid(row=1, column=0, sticky=tk.NW)
self.err_msg_label = tk.Label(
main_frame, justify=tk.LEFT, wraplength=300)
self.err_msg_label["text"] = "No error has occurred."
self.err_msg_label.grid(row=1, column=1, sticky=tk.W)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=0, padx=3, pady=3)
# Start the example if this module is being run
示例9: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.port != None:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
positive_int_vcmd = self.register(self.validate_positive_int_entry)
curr_row = 0
value_label = tk.Label(main_frame)
value_label["text"] = "Value:"
value_label.grid(row=curr_row, column=0, sticky=tk.W)
self.data_value_variable = StringVar()
self.data_value_entry = tk.Spinbox(
main_frame, from_=0, to=255, textvariable=self.data_value_variable,
validate="key", validatecommand=(positive_int_vcmd, "%P"))
self.data_value_entry.grid(row=curr_row, column=1, sticky=tk.W)
self.data_value_variable.trace("w", self.data_value_changed)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.exit
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例10: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.port != None:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
curr_row = 0
bit_values_frame = tk.Frame(main_frame)
bit_values_frame.grid(row=curr_row, column=0, sticky=tk.W)
bit_num_left_label = tk.Label(bit_values_frame)
bit_num_left_label["text"] = "Bit Number:"
bit_num_left_label.grid(row=0, column=0, sticky=tk.W)
bit_values_left_label = tk.Label(bit_values_frame)
bit_values_left_label["text"] = "Value:"
bit_values_left_label.grid(row=1, column=0, sticky=tk.W)
self.bit_value_labels = []
for bit_num in range(0, min(self.port.num_bits, 8)):
bit_num_label = tk.Label(bit_values_frame)
bit_num_label["text"] = str(bit_num)
bit_num_label.grid(row=0, column=bit_num + 1, sticky=tk.W)
# Create an underlined font and assign it to the label
font_underlined = Font(bit_num_label, bit_num_label["font"])
font_underlined["underline"] = True
bit_num_label["font"] = font_underlined
value_label = tk.Label(bit_values_frame)
self.bit_value_labels.append(value_label)
value_label.grid(row=1, column=bit_num + 1, sticky=tk.W)
curr_row += 1
value_left_label = tk.Label(main_frame)
value_left_label["text"] = self.port.type.name + " value read:"
value_left_label.grid(row=curr_row, column=0, sticky=tk.W)
self.value_label = tk.Label(main_frame)
self.value_label.grid(row=curr_row, column=1, sticky=tk.W)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
self.start_button = tk.Button(button_frame)
self.start_button["text"] = "Start"
self.start_button["command"] = self.start
self.start_button.grid(row=0, column=0, padx=3, pady=3)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例11: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.port != None:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
self.results_group = tk.LabelFrame(
self, text="Results", padx=3, pady=3)
self.results_group.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3)
self.results_group.grid_columnconfigure(1, weight=1)
curr_row = 0
status_left_label = tk.Label(self.results_group)
status_left_label["text"] = "Status:"
status_left_label.grid(row=curr_row, column=0, sticky=tk.W)
self.status_label = tk.Label(self.results_group)
self.status_label["text"] = "Idle"
self.status_label.grid(row=curr_row, column=1, sticky=tk.W)
curr_row += 1
index_left_label = tk.Label(self.results_group)
index_left_label["text"] = "Index:"
index_left_label.grid(row=curr_row, column=0, sticky=tk.W)
self.index_label = tk.Label(self.results_group)
self.index_label["text"] = "-1"
self.index_label.grid(row=curr_row, column=1, sticky=tk.W)
curr_row += 1
count_left_label = tk.Label(self.results_group)
count_left_label["text"] = "Count:"
count_left_label.grid(row=curr_row, column=0, sticky=tk.W)
self.count_label = tk.Label(self.results_group)
self.count_label["text"] = "0"
self.count_label.grid(row=curr_row, column=1, sticky=tk.W)
curr_row += 1
self.inner_data_frame = tk.Frame(self.results_group)
self.inner_data_frame.grid(
row=curr_row, column=0, columnspan=2, sticky=tk.W)
self.data_label = tk.Label(self.inner_data_frame)
self.data_label.grid()
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
self.start_button = tk.Button(button_frame)
self.start_button["text"] = "Start"
self.start_button["command"] = self.start
self.start_button.grid(row=0, column=0, padx=3, pady=3)
self.quit_button = tk.Button(button_frame)
self.quit_button["text"] = "Quit"
self.quit_button["command"] = self.master.destroy
self.quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例12: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
if self.ao_props.num_chans > 0:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
channel_vcmd = self.register(self.validate_channel_entry)
float_vcmd = self.register(self.validate_float_entry)
curr_row = 0
if self.ao_props.num_chans > 1:
channel_vcmd = self.register(self.validate_channel_entry)
channel_entry_label = tk.Label(main_frame)
channel_entry_label["text"] = "Channel Number:"
channel_entry_label.grid(
row=curr_row, column=0, sticky=tk.W)
self.channel_entry = tk.Spinbox(
main_frame, from_=0,
to=max(self.ao_props.num_chans - 1, 0),
validate='key', validatecommand=(channel_vcmd, '%P'))
self.channel_entry.grid(
row=curr_row, column=1, sticky=tk.W)
curr_row += 1
units_text = self.ao_props.get_units_string(
self.ao_props.available_ranges[0])
value_label_text = "Value (" + units_text + "):"
data_value_label = tk.Label(main_frame)
data_value_label["text"] = value_label_text
data_value_label.grid(row=curr_row, column=0, sticky=tk.W)
self.data_value_entry = tk.Entry(
main_frame, validate='key', validatecommand=(float_vcmd, '%P'))
self.data_value_entry.grid(row=curr_row, column=1, sticky=tk.W)
self.data_value_entry.insert(0, "0")
update_button = tk.Button(main_frame)
update_button["text"] = "Update"
update_button["command"] = self.update_value
update_button.grid(row=curr_row, column=2, padx=3, pady=3)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=0, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例13: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
example_supported = (
self.ao_props.num_chans > 0
and self.ao_props.supports_scan)
if example_supported:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
data_frame = tk.Frame(main_frame)
data_frame.pack(fill=tk.X, anchor=tk.NW)
raw_data_label = tk.Label(data_frame)
raw_data_label["text"] = "Raw Data"
raw_data_label.grid(row=1, sticky=tk.W)
volts_label = tk.Label(data_frame)
volts_label["text"] = "Volts"
volts_label.grid(row=2, sticky=tk.W)
self.raw_data_labels = []
self.volts_labels = []
for chan_num in range(0, min(self.ao_props.num_chans, 4)):
name_label = tk.Label(data_frame)
name_label["text"] = "Channel " + str(chan_num)
name_label.grid(row=0, column=chan_num + 1, sticky=tk.W)
raw_data_label = tk.Label(data_frame)
raw_data_label.grid(row=1, column=chan_num + 1, sticky=tk.W)
self.raw_data_labels.append(raw_data_label)
volts_label = tk.Label(data_frame)
volts_label.grid(row=2, column=chan_num + 1, sticky=tk.W)
self.volts_labels.append(volts_label)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
send_data_button = tk.Button(button_frame)
send_data_button["text"] = "Start"
send_data_button["command"] = self.send_data
send_data_button.grid(row=0, column=0, padx=3, pady=3)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例14: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
example_supported = self.first_chan_num != -1
if example_supported:
main_frame = tk.Frame(self)
main_frame.pack(fill=tk.X, anchor=tk.NW)
channel_vcmd = self.register(self.validate_channel_entry)
float_vcmd = self.register(self.validate_float_entry)
curr_row = 0
if self.last_chan_num != self.first_chan_num:
channel_entry_label = tk.Label(main_frame)
channel_entry_label["text"] = "Channel Number:"
channel_entry_label.grid(row=curr_row, column=0, sticky=tk.W)
self.channel_entry = tk.Spinbox(
main_frame, from_=self.first_chan_num, to=self.last_chan_num,
validate='key', validatecommand=(channel_vcmd, '%P'))
self.channel_entry.grid(row=curr_row, column=1, sticky=tk.W)
curr_row += 1
freq_label = tk.Label(main_frame)
freq_label["text"] = "Frequency:"
freq_label.grid(row=curr_row, column=0, sticky=tk.W)
self.freq_entry = tk.Entry(
main_frame, validate='key', validatecommand=(float_vcmd, '%P'))
self.freq_entry.grid(row=curr_row, column=1, sticky=tk.W)
self.freq_entry.insert(0, "100000")
curr_row += 1
update_button = tk.Button(main_frame)
update_button["text"] = "Update"
update_button["command"] = self.update_output
update_button.grid(row=curr_row, column=0,
columnspan=2, padx=3, pady=3)
curr_row += 1
actual_freq_left_label = tk.Label(main_frame)
actual_freq_left_label["text"] = "Actual Frequency:"
actual_freq_left_label.grid(row=curr_row, column=0, sticky=tk.W)
self.actual_freq_label = tk.Label(main_frame)
self.actual_freq_label.grid(row=curr_row, column=1, sticky=tk.W)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.exit
quit_button.grid(row=0, column=1, padx=3, pady=3)
else:
self.create_unsupported_widgets(self.board_num)
示例15: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import SE [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
self.info_groupbox = tk.LabelFrame(self, text="Installed Devices")
self.info_groupbox.pack(
fill=tk.BOTH, anchor=tk.NW, padx=3, pady=3, expand=True)
scrollbar = tk.Scrollbar(self.info_groupbox)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y, padx=3, pady=3)
self.info_text = tk.Text(
self.info_groupbox, width=50, height=15, wrap=tk.WORD,
yscrollcommand=scrollbar.set)
self.info_text.pack(
side=tk.LEFT, fill=tk.BOTH, padx=3, pady=3, expand=True)
scrollbar.config(command=self.info_text.yview)
upper_button_frame = tk.Frame(self)
upper_button_frame.pack(fill=tk.BOTH, anchor=tk.S)
upper_button_frame.grid_columnconfigure(0, weight=1)
upper_button_frame.grid_columnconfigure(1, weight=1)
list_installed_button = tk.Button(upper_button_frame)
list_installed_button["text"] = "List Installed"
list_installed_button["command"] = self.list_installed
list_installed_button.grid(
row=0, column=0, padx=3, pady=3, sticky=tk.NSEW)
list_installed_button = tk.Button(upper_button_frame)
list_installed_button["text"] = "List Supported"
list_installed_button["command"] = self.list_supported
list_installed_button.grid(
row=0, column=1, padx=3, pady=3, sticky=tk.NSEW)
button_frame = tk.Frame(self)
button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE)
quit_button = tk.Button(button_frame)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(row=0, column=0, padx=3, pady=3)
# Start the example if this module is being run