本文整理汇总了Python中tkinter.NE属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.NE属性的具体用法?Python tkinter.NE怎么用?Python tkinter.NE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.NE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NE [as 别名]
def __init__(self):
super().__init__()
self.title("Ttk Notebook")
todos = {
"Home": ["Do the laundry", "Go grocery shopping"],
"Work": ["Install Python", "Learn Tkinter", "Reply emails"],
"Vacations": ["Relax!"]
}
self.notebook = ttk.Notebook(self, width=250, height=100, padding=10)
for key, value in todos.items():
frame = ttk.Frame(self.notebook)
self.notebook.add(frame, text=key, underline=0,
sticky=tk.NE + tk.SW)
for text in value:
ttk.Label(frame, text=text).pack(anchor=tk.W)
self.label = ttk.Label(self)
self.notebook.pack()
self.label.pack(anchor=tk.W)
self.notebook.enable_traversal()
self.notebook.bind("<<NotebookTabChanged>>", self.select_tab)
示例2: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NE [as 别名]
def __init__(self, window):
self.window = window
self.window.title('Google Translate')
frm = tk.Frame(self.window)
frm.pack(anchor=tk.NW, fill=tk.BOTH, expand=1)
frm_input = tk.Frame(frm)
frm_output = tk.Frame(frm)
frm_input.pack(anchor=tk.NW, fill=tk.X)
frm_output.pack(anchor=tk.NW, fill=tk.BOTH, expand=1)
self.input_text = tk.StringVar()
self.input_entry = ttk.Entry(frm_input, textvariable=self.input_text)
self.input_entry.pack(side=tk.LEFT, fill=tk.X, expand=1)
self.run_queue = Queue()
self.trans_button = ttk.Button(frm_input, text='trans', width=6, command=self.run)
self.trans_button.pack(anchor=tk.NE, side=tk.LEFT)
self.st = scrolledtext.ScrolledText(frm_output, state=tk.NORMAL)
self.st.insert(tk.END, 'Google Translate\n')
self.st.pack(anchor=tk.NW, fill=tk.BOTH, expand=1)
self.input_entry.bind('<Return>', self.run)
self.input_entry.bind('<Escape>', lambda event=None: self.input_text.set(''))
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NE [as 别名]
def __init__(self, json_str, runner, master=None):
# first make sure that the json data has the correct fields
j = json.loads(json_str)
self.name = j['name']
self.description = j['description']
self.flag = j['flags'][len(j['flags']) - 1]
self.parameter_type = j['parameter_type']
self.file_type = ""
self.file_type = j['parameter_type']['FileList']
self.optional = j['optional']
default_value = j['default_value']
self.runner = runner
ttk.Frame.__init__(self, master)
self.grid()
self['padding'] = '0.05i'
self.label = ttk.Label(self, text=self.name, justify=tk.LEFT)
self.label.grid(row=0, column=0, sticky=tk.W)
self.label.columnconfigure(0, weight=1)
if not self.optional:
self.label['text'] = self.label['text'] + "*"
fs_frame = ttk.Frame(self, padding='0.0i')
# , variable=self.value)
self.opt = tk.Listbox(fs_frame, width=44, height=4)
self.opt.grid(row=0, column=0, sticky=tk.NSEW)
s = ttk.Scrollbar(fs_frame, orient=tk.VERTICAL, command=self.opt.yview)
s.grid(row=0, column=1, sticky=(tk.N, tk.S))
self.opt['yscrollcommand'] = s.set
btn_frame = ttk.Frame(fs_frame, padding='0.0i')
self.open_button = ttk.Button(
btn_frame, width=4, text="...", command=self.select_file)
self.open_button.grid(row=0, column=0, sticky=tk.NE)
self.open_button.columnconfigure(0, weight=1)
self.open_button.rowconfigure(0, weight=1)
self.delete_button = ttk.Button(
btn_frame, width=4, text="del", command=self.delete_entry)
self.delete_button.grid(row=1, column=0, sticky=tk.NE)
self.delete_button.columnconfigure(0, weight=1)
self.delete_button.rowconfigure(1, weight=1)
btn_frame.grid(row=0, column=2, sticky=tk.NE)
fs_frame.grid(row=1, column=0, sticky=tk.NSEW)
fs_frame.columnconfigure(0, weight=10)
fs_frame.columnconfigure(1, weight=1)
fs_frame.columnconfigure(2, weight=1)
# self.pack(fill=tk.BOTH, expand=1)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
self.rowconfigure(1, weight=1)