本文整理汇总了Python中tkinter.Checkbutton.pack方法的典型用法代码示例。如果您正苦于以下问题:Python Checkbutton.pack方法的具体用法?Python Checkbutton.pack怎么用?Python Checkbutton.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Checkbutton
的用法示例。
在下文中一共展示了Checkbutton.pack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PasswordDialog
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
class PasswordDialog(Dialog):
def __init__(self, title, prompt, parent):
self.prompt = prompt
Dialog.__init__(self, parent, title)
def body(self, master):
from tkinter import Label
from tkinter import Entry
from tkinter import Checkbutton
from tkinter import IntVar
from tkinter import W
self.checkVar = IntVar()
Label(master, text=self.prompt).grid(row=0, sticky=W)
self.e1 = Entry(master)
self.e1.grid(row=0, column=1)
self.cb = Checkbutton(master, text="Save to keychain", variable=self.checkVar)
self.cb.pack()
self.cb.grid(row=1, columnspan=2, sticky=W)
self.e1.configure(show='*')
def apply(self):
self.result = (self.e1.get(), self.checkVar.get() == 1)
示例2: create_other_buttons
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def create_other_buttons(self):
f = self.make_frame()[0]
btn = Checkbutton(f, anchor="w",
variable=self.recvar,
text="Recurse down subdirectories")
btn.pack(side="top", fill="both")
btn.select()
示例3: create_option_buttons
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def create_option_buttons(self):
"Fill frame with Checkbuttons bound to SearchEngine booleanvars."
f = self.make_frame("Options")
btn = Checkbutton(f, anchor="w",
variable=self.engine.revar,
text="Regular expression")
btn.pack(side="left", fill="both")
if self.engine.isre():
btn.select()
btn = Checkbutton(f, anchor="w",
variable=self.engine.casevar,
text="Match case")
btn.pack(side="left", fill="both")
if self.engine.iscase():
btn.select()
btn = Checkbutton(f, anchor="w",
variable=self.engine.wordvar,
text="Whole word")
btn.pack(side="left", fill="both")
if self.engine.isword():
btn.select()
if self.needwrapbutton:
btn = Checkbutton(f, anchor="w",
variable=self.engine.wrapvar,
text="Wrap around")
btn.pack(side="left", fill="both")
if self.engine.iswrap():
btn.select()
示例4: ProgressCheckButton
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
class ProgressCheckButton(Frame, Observable):
def __init__(self, parent, model, index, status_model):
Frame.__init__(self, parent)
Observable.__init__(self)
self.model = model
self.index = index
self.status_model = status_model
self.var = IntVar()
self.var.set(model.get_checked())
self.progress_var = IntVar()
self.progress_status = ProgressStatus.undefined
self.check_button = Checkbutton(self, text=model.get_label, variable=self.var, command=self._check_changed)
self.progress_bar = Progressbar(self, orient='horizontal', mode='indeterminate', variable=self.progress_var)
self.check_button.pack(side=LEFT, fill="both", expand=True)
self.model.add_listener(self._model_changed)
def _model_changed(self, new_status):
model_state = self.model.get_checked()
gui_state = self.var.get()
if model_state is not gui_state:
self.model.set_checked(gui_state)
def refresh_check(self):
if self.status_model.is_checked_force_reload():
self.check_button.select()
else:
self.check_button.deselect()
def is_checked(self):
return self.var.get()
def _progress_status_changed(self, new_status):
self._refresh_progress()
def _refresh_progress(self):
status = self.status_model.get_status()
if not status == self.progress_status:
if status == ProgressStatus.in_progress:
self.progress_bar.pack(side=RIGHT, fill="both", expand=True)
else:
self.progress_bar.pack_forget()
def _check_changed(self):
new_checked = self.var.get()
if new_checked is not self.model.get_checked():
self.model.set_checked(new_checked)
if new_checked is not self.status_model.is_checked():
self._notify(self.index, new_checked)
示例5: create_option_buttons
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def create_option_buttons(self):
"Fill frame with Checkbuttons bound to SearchEngine booleanvars."
frame = self.make_frame("Options")[0]
engine = self.engine
options = [(engine.revar, "Regular expression"),
(engine.casevar, "Match case"),
(engine.wordvar, "Whole word")]
if self.needwrapbutton:
options.append((engine.wrapvar, "Wrap around"))
for var, label in options:
btn = Checkbutton(frame, anchor="w", variable=var, text=label)
btn.pack(side="left", fill="both")
if var.get():
btn.select()
return frame, options # for test
示例6: ProgressListBoxItem
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
class ProgressListBoxItem(Frame, Observable):
def __init__(self, parent, model):
Frame.__init__(self, parent)
Observable.__init__(self)
self._model = model
# Create variables and initialise to zero
self._checked_var = IntVar()
self._progress_var = IntVar()
self._checked_var.set(0)
self._progress_var.set(0)
self._current_gui_checked_state = CheckStatus.undefined
self._current_gui_progress_state = ProgressStatus.undefined
self.check_button = Checkbutton(self, text=model.get_label(), variable=self._checked_var, command=self._user_check_changed)
self.progress_bar = Progressbar(self, orient='horizontal', mode='indeterminate', variable=self._progress_var)
self.check_button.pack(side=LEFT, fill="both", expand=True)
self._update()
self._model.add_listener(self._model_changed)
def _model_changed(self):
self.update()
def _update(self):
# Update check status
model_check_state = self._model.get_check_status()
if model_check_state is not self._current_gui_checked_state:
self._current_gui_checked_state = model_check_state
# if self.status_model.is_checked_force_reload():
if model_check_state:
self.check_button.select()
else:
self.check_button.deselect()
# Update progress status
model_progress_state = self._model.get_progress_status
if not model_progress_state == self._current_gui_progress_state:
self._current_gui_progress_state = model_progress_state
if model_progress_state == ProgressStatus.in_progress:
self.progress_bar.pack(side=RIGHT, fill="both", expand=True)
else:
self.progress_bar.pack_forget()
def _user_check_changed(self):
new_checked = self._checked_var.get()
if new_checked is not self._model.get_check_status():
self._model.manual_set_checked(new_checked)
示例7: create_option_buttons
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def create_option_buttons(self):
"""Return (filled frame, options) for testing.
Options is a list of SearchEngine booleanvar, label pairs.
A gridded frame from make_frame is filled with a Checkbutton
for each pair, bound to the var, with the corresponding label.
"""
frame = self.make_frame("Options")[0]
engine = self.engine
options = [(engine.revar, "Regular expression"), (engine.casevar, "Match case"), (engine.wordvar, "Whole word")]
if self.needwrapbutton:
options.append((engine.wrapvar, "Wrap around"))
for var, label in options:
btn = Checkbutton(frame, anchor="w", variable=var, text=label)
btn.pack(side="left", fill="both")
if var.get():
btn.select()
return frame, options
示例8: _makesetting
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def _makesetting(setting_window, conf):
setting_label = Label(setting_window,
text=_('Setting'),
font=('courier', 20, 'bold'))
setting_label.pack(side=TOP)
style_container = Frame(setting_window)
style_container.pack(side=TOP)
style_label = Label(style_container,
text=_('Display wallpaper in style: '),
font=('courier', 15, 'bold'))
style_label.pack(side=LEFT)
style_combobox = Combobox(style_container)
available_style = {'3': 'zoom', '2': 'scaled', '1': 'stretched', '0': 'centered', '4': 'wallpaper'}
style_combobox['value'] = (_('centered'), _('stretched'), _('scaled'), _('zoom'), _('wallpaper'))
style_combobox.state(['readonly'])
style_combobox.current(int(conf['style']))
style_combobox.pack(side=LEFT)
random_container = Frame(setting_window)
random_container.pack(side=TOP)
random_label = Label(random_container,
text=_('Choose wallpaper randomly? '),
font=('courier', 15, 'bold'))
random_label.pack(side=LEFT)
random_checkbutton = Checkbutton(random_container)
random_checkbutton.pack(side=LEFT)
if conf['random'] == "1":
random_checkbutton.select()
interval_container = Frame(setting_window)
interval_container.pack(side=TOP)
interval_label = Label(interval_container,
text=_('Change wallpaper every '),
font=('courier', 15, 'bold'))
interval_label.pack(side=LEFT)
interval_text = Text(interval_container, height=1, width=4)
interval_text.insert(END, conf['interval'])
interval_text.pack(side=LEFT)
minute_label = Label(interval_container,
text=_(' minutes.'),
font=('courier', 15, 'bold'))
minute_label.pack(side=LEFT)
示例9: _init_ui
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def _init_ui(self):
# Label to specify video link
lbl_video_url = Label(self, text="Video URL:")
lbl_video_url.place(x=20, y=20)
# Entry to enter video url
entr_video_url = Entry(self, width=50, textvariable=self._video_url)
entr_video_url.place(x=100, y=20)
# Checkbutton to extract audio
cb_extract_audio = Checkbutton(self, var=self._extract_audio, text="Only keep audio")
cb_extract_audio.pack()
cb_extract_audio.place(x=20, y=60)
# Button to browse for location
b_folder_choose = Button(self, text="Choose output directory", command=self.ask_directory)
b_folder_choose.place(x=150, y=90)
# Button to start downloading
b_start_download = Button(self, text="Start download", command=self.download)
b_start_download.place(x=20, y=90)
# Log window to log progress
self._logger.place(x=20, y=130)
示例10: __init__
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def __init__(self, master):
self.init_args()
self.master = master
master.title("Helper")
self.label = Label(master, text="Parser Helper")
self.label.pack()
self.exception_value = IntVar()
# Exception
C1 = Checkbutton(master, text="Exception", variable=self.exception_value, \
onvalue=1, offvalue=0, height=5, \
width=20)
C1.pack()
self.cause_value = IntVar()
# Cause by
C2 = Checkbutton(master, text="Cause by", variable=self.cause_value, \
onvalue=1, offvalue=0, height=5, \
width=20)
C2.pack()
# Verbose
self.verbose_value = IntVar()
C3 = Checkbutton(master, text="Verbose", variable=self.verbose_value, \
onvalue=1, offvalue=0, height=5, \
width=20)
C3.pack()
# Log to file
self.log_value = IntVar()
C4 = Checkbutton(master, text="Log to file", variable=self.log_value, \
onvalue=1, offvalue=0, height=5, \
width=20)
C4.pack()
self.greet_button = Button(master, text="Select file", command=self.open_file)
self.greet_button.pack()
self.close_button = Button(master, text="Execute", command=self.execute)
self.close_button.pack()
self.close_button = Button(master, text="Quit", command=master.quit)
self.close_button.pack()
示例11: closeAndStartUmineko
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def closeAndStartUmineko():
rootWindow.withdraw()
mainUmineko()
installFinishedMessage = "Install Finished. Temporary install files have been displayed - please delete the " \
"temporary files after checking the mod has installed correctly."
print(installFinishedMessage)
messagebox.showinfo("Install Completed", installFinishedMessage)
rootWindow.destroy()
# Add an 'OK' button. When pressed, the dialog is closed
defaultPadding = {"padx": 20, "pady": 10}
b = tkinter.Button(rootWindow, text="Install Higurashi Mods", command=closeAndStartHigurashi)
b.pack(**defaultPadding)
b = tkinter.Button(rootWindow, text="Install Umineko Mods", command=closeAndStartUmineko)
b.pack(**defaultPadding)
tkinter.Label(rootWindow, text="Advanced Settings").pack()
# Add a checkbox to enable/disable IPV6. IPV6 is disabled by default due to some
# installations failing when IPV6 is used due to misconfigured routers/other problems.
use_ipv6_var = IntVar()
def onIPV6CheckboxToggled():
GLOBAL_SETTINGS.USE_IPV6 = use_ipv6_var.get()
c = Checkbutton(rootWindow, text="Enable IPv6", var=use_ipv6_var, command=onIPV6CheckboxToggled)
c.pack()
rootWindow.mainloop()
示例12: ProblemBrowser
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
class ProblemBrowser(object):
def __init__(self):
self.action = None
self.root = root = Tk()
root.title('Never gonna fold you up')
root.protocol("WM_DELETE_WINDOW", self.close)
root.pack_propagate(True)
scrollbar = Scrollbar(root, orient=tkinter.VERTICAL)
self.problem_list = Listbox(root, exportselection=False, yscrollcommand=scrollbar.set)
self.problem_list.pack(expand=True, fill=tkinter.BOTH, side=tkinter.LEFT)
scrollbar.config(command=self.problem_list.yview)
scrollbar.pack(side=tkinter.LEFT, fill=tkinter.Y)
self.problem_list.bind('<<ListboxSelect>>', lambda evt: self.populate_problem_canvas())
self.problem_canvas = Canvas(root, bd=1, relief=tkinter.SUNKEN, width=500, height=500)
self.problem_canvas.pack(expand=True, fill=tkinter.BOTH, side=tkinter.LEFT)
self.problem_canvas.bind("<Configure>", lambda evt: self.populate_problem_canvas())
button_frame = Frame(root)
button_frame.pack(fill=tkinter.Y, side=tkinter.LEFT)
# Reposition the figure so it's center of mass is at 0.5, 0.5
v = IntVar()
self.center_cb = Checkbutton(button_frame, text="center", variable=v, command=lambda: self.populate_problem_canvas())
self.center_cb.var = v
self.center_cb.pack(side=tkinter.TOP)
# Use meshes.reconstruct_facets instead of polygon/hole logic.
v = IntVar()
self.reconstruct_cb = Checkbutton(button_frame, text="reconstruct", variable=v, command=lambda: self.populate_problem_canvas())
self.reconstruct_cb.var = v
self.reconstruct_cb.pack(side=tkinter.TOP)
self.populate_problems()
self.current_problem_name = None
self.current_problem = None
def populate_problems(self):
self.problem_list.delete(0, tkinter.END)
for file in sorted((get_root() / 'problems').iterdir()):
self.problem_list.insert(tkinter.END, file.stem)
def populate_problem_canvas(self):
sel = self.problem_list.curselection()
if not sel: return
assert len(sel) == 1
name = self.problem_list.get(sel[0])
if name != self.current_problem_name:
self.current_problem_name = name
self.current_problem = load_problem(name)
if self.current_problem:
p = self.current_problem
if self.center_cb.var.get():
p = center_problem(p)
if self.reconstruct_cb.var.get():
facets = meshes.reconstruct_facets(p)
facets = meshes.keep_real_facets(facets, p)
skeleton = [e for f in facets for e in edges_of_a_facet(f)]
p = Problem(facets, skeleton)
draw_problem(self.problem_canvas, p)
def run(self):
self.root.mainloop()
def close(self):
if self.root:
self.root.destroy()
self.root = None
示例13: sideWindow
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
class sideWindow(AppShell):
#################################################################
# sideWindow(AppShell)
# This class will open a side window wich contains a scene graph and
# a world setting page.
#################################################################
appversion = '1.0'
appname = 'Navigation Window'
frameWidth = 325
frameHeight = 580
frameIniPosX = 0
frameIniPosY = 110
padx = 0
pady = 0
lightEnable = 0
ParticleEnable = 0
basedriveEnable = 0
collision = 0
backface = 0
texture = 1
wireframe = 0
enableBaseUseDrive = 0
def __init__(self, worldColor,lightEnable,ParticleEnable, basedriveEnable,collision,
backface, texture, wireframe, grid, widgetVis, enableAutoCamera, parent = None, nodePath = render, **kw):
self.worldColor = worldColor
self.lightEnable = lightEnable
self.ParticleEnable = ParticleEnable
self.basedriveEnable = basedriveEnable
self.collision = collision
self.backface = backface
self.texture = texture
self.wireframe = wireframe
self.grid = grid
self.enableAutoCamera = enableAutoCamera
self.widgetVis = widgetVis
# Define the megawidget options.
optiondefs = (
('title', self.appname, None),
)
self.defineoptions(kw, optiondefs)
if parent == None:
self.parent = Toplevel()
else:
self.parent = parent
AppShell.__init__(self, self.parent)
self.parent.geometry('%dx%d+%d+%d' % (self.frameWidth, self.frameHeight,self.frameIniPosX,self.frameIniPosY))
self.parent.resizable(False,False) ## Disable the ability to resize for this Window.
def appInit(self):
print('----SideWindow is Initialized!!')
def createInterface(self):
# The interior of the toplevel panel
interior = self.interior()
mainFrame = Frame(interior)
## Creat NoteBook
self.notebookFrame = Pmw.NoteBook(mainFrame)
self.notebookFrame.pack(fill=tkinter.BOTH,expand=1)
sgePage = self.notebookFrame.add('Tree Graph')
envPage = self.notebookFrame.add('World Setting')
self.notebookFrame['raisecommand'] = self.updateInfo
## Tree Grapgh Page
self.SGE = seSceneGraphExplorer.seSceneGraphExplorer(
sgePage, nodePath = render,
scrolledCanvas_hull_width = 270,
scrolledCanvas_hull_height = 570)
self.SGE.pack(fill = tkinter.BOTH, expand = 0)
## World Setting Page
envPage = Frame(envPage)
pageFrame = Frame(envPage)
self.LightingVar = IntVar()
self.LightingVar.set(self.lightEnable)
self.LightingButton = Checkbutton(
pageFrame,
text = 'Enable Lighting',
variable = self.LightingVar,
command = self.toggleLights)
self.LightingButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
pageFrame = Frame(envPage)
self.CollisionVar = IntVar()
self.CollisionVar.set(self.collision)
self.CollisionButton = Checkbutton(
pageFrame,
text = 'Show Collision Object',
variable = self.CollisionVar,
command = self.showCollision)
self.CollisionButton.pack(side=tkinter.LEFT, expand=False)
pageFrame.pack(side=tkinter.TOP, fill=tkinter.X, expand=True)
#.........这里部分代码省略.........
示例14: MiniSedGUI
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
class MiniSedGUI(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.cfg = MiniSedConfig()
self.source_directory = None
self.target_directory = None
self.create_widgets()
self.pack(anchor=CENTER, fill=BOTH, expand=1)
self.files_with_content = []
self.cfg.directory.trace('w', self.disable_apply)
self.cfg.glob.trace('w', self.disable_apply)
self.cfg.search.trace('w', self.disable_apply)
self.cfg.replace.trace('w', self.disable_apply)
self.cfg.ignore_case.trace('w', self.disable_apply)
def disable_apply(self, *args):
self.run_btn["state"] = 'disabled'
def create_widgets(self):
self.directory_frame = Frame(self)
self.directory_frame.pack(side=TOP, fill=X, expand=0, padx=4, pady=4)
self.directory_frame.grid_columnconfigure(1, weight=1)
self.directory_label = Label(self.directory_frame, text="Directory:")
self.directory_label.grid(column=0, row=0)
self.directory_entry = Entry(self.directory_frame, textvariable=self.cfg.directory)
self.directory_entry.grid(column=1, row=0, sticky=W + E)
self.directory_entry.bind('<Return>', lambda arg: self.do_preview())
self.directory_button = Button(self.directory_frame, text="Browse")
self.directory_button["command"] = lambda: do_ask_directory(self.cfg.directory)
self.directory_button.grid(column=2, row=0)
self.glob_label = Label(self.directory_frame, text="Glob:")
self.glob_label.grid(column=0, row=1, stick=E)
self.glob_entry = Entry(self.directory_frame, textvariable=self.cfg.glob)
self.glob_entry.bind('<Return>', lambda arg: self.do_preview())
self.glob_entry.grid(column=1, row=1, sticky=N + S + W)
self.search_replace_frame = Frame(self)
self.search_replace_frame.grid_columnconfigure(1, weight=1)
self.search_replace_frame.pack(anchor=N, side=TOP, fill=X, expand=0, padx=4, pady=4)
self.search_label = Label(self.search_replace_frame, text="Search:")
self.search_label.grid(column=0, row=0, sticky=E)
self.search_entry = Entry(self.search_replace_frame, textvariable=self.cfg.search)
self.search_entry.grid(column=1, row=0, sticky=N + S + W + E)
self.search_entry.bind('<Return>', lambda arg: self.do_preview())
self.replace_label = Label(self.search_replace_frame, text="Replace:")
self.replace_label.grid(column=0, row=1, sticky=E)
self.replace_entry = Entry(self.search_replace_frame, textvariable=self.cfg.replace)
self.replace_entry.grid(column=1, row=1, sticky=N + S + W + E)
self.replace_entry.bind('<Return>', lambda arg: self.do_preview())
self.option_frame = Frame(self)
self.option_frame.pack(side=TOP, fill=X, expand=0, pady=4)
self.work_frame = LabelFrame(self.option_frame, text="Options")
self.work_frame.pack(side=LEFT, padx=4, pady=4)
self.ignore_case_checkbutton = Checkbutton(
self.work_frame, text="ignore case", variable=self.cfg.ignore_case)
self.ignore_case_checkbutton.pack(side=TOP, anchor=W, expand=0)
self.create_backups_checkbutton = Checkbutton(
self.work_frame, text="create backups", variable=self.cfg.create_backups)
self.create_backups_checkbutton.pack(side=TOP, anchor=W, expand=0)
self.preview_frame = LabelFrame(self.option_frame, text="Preview")
self.preview_frame.pack(side=LEFT, padx=4, pady=4)
self.show_full_content_checkbutton = Checkbutton(
self.preview_frame, text="show full content", variable=self.cfg.show_full_content)
self.show_full_content_checkbutton.pack(side=TOP, anchor=W, expand=0)
self.show_original_checkbutton = Checkbutton(
self.preview_frame, text="show original", variable=self.cfg.show_original)
self.show_original_checkbutton.pack(side=TOP, anchor=W, expand=0)
self.text_frame = Frame(self)
self.text_frame.pack(side=TOP, fill=BOTH, expand=1, pady=4)
self.text_frame.grid_columnconfigure(0, weight=1)
self.text_frame.grid_rowconfigure(0, weight=1)
self.scrollbar = Scrollbar(self.text_frame)
self.scrollbar.grid(column=1, row=0, sticky=N + S)
self.text = Text(self.text_frame, yscrollcommand=self.scrollbar.set, width=120, height=20)
self.text.tag_config("file", background="lightgray", foreground="black")
#.........这里部分代码省略.........
示例15: init_gui
# 需要导入模块: from tkinter import Checkbutton [as 别名]
# 或者: from tkinter.Checkbutton import pack [as 别名]
def init_gui(self):
"""init helper"""
# setting up frames
top_frame = Frame(self.root)
mid_frame = Frame(self.root)
radio_frame = Frame(self.root)
res_frame = Frame(self.root)
msg_frame = Frame(self.root)
check_frame = Frame(self.root)
history_frame = Frame(self.root)
btn_frame = Frame(self.root)
rating_frame = Frame(self.root)
top_frame.pack(side=TOP, fill=X)
mid_frame.pack(side=TOP, fill=X)
history_frame.pack(side=TOP, fill=BOTH, expand=True)
radio_frame.pack(side=TOP, fill=BOTH, expand=True)
rating_frame.pack(side=TOP, fill=BOTH, expand=True)
res_frame.pack(side=TOP, fill=BOTH, expand=True)
check_frame.pack(side=TOP, fill=BOTH, expand=True)
msg_frame.pack(side=TOP, fill=BOTH, expand=True)
btn_frame.pack(side=TOP, fill=X)
# Message ListBox
rightscrollbar = Scrollbar(msg_frame)
rightscrollbar.pack(side=RIGHT, fill=Y)
bottomscrollbar = Scrollbar(msg_frame, orient=HORIZONTAL)
bottomscrollbar.pack(side=BOTTOM, fill=X)
self.lbMessages = Listbox(
msg_frame, yscrollcommand=rightscrollbar.set, xscrollcommand=bottomscrollbar.set, bg="white"
)
self.lbMessages.pack(expand=True, fill=BOTH)
rightscrollbar.config(command=self.lbMessages.yview)
bottomscrollbar.config(command=self.lbMessages.xview)
# History ListBoxes
rightscrollbar2 = Scrollbar(history_frame)
rightscrollbar2.pack(side=RIGHT, fill=Y)
bottomscrollbar2 = Scrollbar(history_frame, orient=HORIZONTAL)
bottomscrollbar2.pack(side=BOTTOM, fill=X)
self.showhistory = Listbox(
history_frame, yscrollcommand=rightscrollbar2.set, xscrollcommand=bottomscrollbar2.set, bg="white"
)
self.showhistory.pack(expand=True, fill=BOTH)
rightscrollbar2.config(command=self.showhistory.yview)
bottomscrollbar2.config(command=self.showhistory.xview)
self.showhistory.bind("<Double-Button-1>", self.select_recent_file)
self.set_history_window()
# status bar
self.status = Label(self.root, text="", bd=1, relief=SUNKEN, anchor=W)
self.status.pack(side=BOTTOM, fill=X)
# labels
self.lblRatingLabel = Label(rating_frame, text="Rating:")
self.lblRatingLabel.pack(side=LEFT)
self.lblRating = Label(rating_frame, textvariable=self.rating)
self.lblRating.pack(side=LEFT)
Label(mid_frame, text="Recently Used:").pack(side=LEFT)
Label(top_frame, text="Module or package").pack(side=LEFT)
# file textbox
self.txtModule = Entry(top_frame, background="white")
self.txtModule.bind("<Return>", self.run_lint)
self.txtModule.pack(side=LEFT, expand=True, fill=X)
# results box
rightscrollbar = Scrollbar(res_frame)
rightscrollbar.pack(side=RIGHT, fill=Y)
bottomscrollbar = Scrollbar(res_frame, orient=HORIZONTAL)
bottomscrollbar.pack(side=BOTTOM, fill=X)
self.results = Listbox(
res_frame, yscrollcommand=rightscrollbar.set, xscrollcommand=bottomscrollbar.set, bg="white", font="Courier"
)
self.results.pack(expand=True, fill=BOTH, side=BOTTOM)
rightscrollbar.config(command=self.results.yview)
bottomscrollbar.config(command=self.results.xview)
# buttons
Button(top_frame, text="Open", command=self.file_open).pack(side=LEFT)
Button(top_frame, text="Open Package", command=(lambda: self.file_open(package=True))).pack(side=LEFT)
self.btnRun = Button(top_frame, text="Run", command=self.run_lint)
self.btnRun.pack(side=LEFT)
Button(btn_frame, text="Quit", command=self.quit).pack(side=BOTTOM)
# radio buttons
self.information_box = IntVar()
self.convention_box = IntVar()
self.refactor_box = IntVar()
self.warning_box = IntVar()
self.error_box = IntVar()
self.fatal_box = IntVar()
i = Checkbutton(
check_frame,
text="Information",
fg=COLORS["(I)"],
variable=self.information_box,
command=self.refresh_msg_window,
)
c = Checkbutton(
#.........这里部分代码省略.........