本文整理汇总了Python中tkinter.Message方法的典型用法代码示例。如果您正苦于以下问题:Python tkinter.Message方法的具体用法?Python tkinter.Message怎么用?Python tkinter.Message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter
的用法示例。
在下文中一共展示了tkinter.Message方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def __init__(self, parent, **kwargs):
super().__init__(parent,
bd=7,
bg="white smoke",
**kwargs)
tk.Frame(self,width=340,
height=340).grid(sticky="nswe")
self.info_label = tk.Message(self,
font=self.font,
anchor=tk.CENTER,
bg="white smoke",
width=1000)
self.comments = tk.Label(self,
justify=tk.LEFT,
font=self.comment_font,
width=20,
bg="white smoke")
self.info_label.grid(row=0, column=0, sticky="nswe")
self.comments.grid(row=1, column=0, sticky="nse")
self.ticket = None
示例2: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def __init__(self, parent, msg, title, hidden, text_variable):
tk.Frame.__init__(self, parent)
self.parent = parent
self.parent.protocol("WM_DELETE_WINDOW", self.cancel_function)
self.parent.bind('<Return>', self.ok_function)
self.parent.title(title)
self.input_text = text_variable
if Settings.PopupLocation:
self.parent.geometry("+{}+{}".format(
Settings.PopupLocation.x,
Settings.PopupLocation.y))
self.msg = tk.Message(self.parent, text=msg)
self.msg.grid(row=0, sticky="NSEW", padx=10, pady=10)
self.input_entry = tk.Entry(self.parent, width=50, textvariable=self.input_text)
if hidden:
self.input_entry.config(show="*")
self.input_entry.grid(row=1, sticky="EW", padx=10)
self.button_frame = tk.Frame(self.parent)
self.button_frame.grid(row=2, sticky="E")
self.cancel = tk.Button(
self.button_frame,
text="Cancel",
command=self.cancel_function,
width=10)
self.cancel.grid(row=0, column=0, padx=10, pady=10)
self.ok_button = tk.Button(
self.button_frame,
text="Ok",
command=self.ok_function,
width=10)
self.ok_button.grid(row=0, column=1, padx=10, pady=10)
self.input_entry.focus_set()
示例3: create
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def create(self, **kwargs):
return tkinter.Message(self.root, **kwargs)
示例4: body
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def body(self, master):
self.frame = tk.Frame(master)
self.message = tk.Message(self.frame, text=self.messageText)
self.btn_cancel = tk.Button(self.frame, text="Cancel", command=self.cancel)
self.bind("<Return>", self.cancel)
self.frame.grid(column=0, row=0, sticky="NSEW")
self.message.grid(column=0, row=1)
self.btn_cancel.grid(column=0, row=2)
return self.btn_cancel
示例5: about_app
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def about_app(self):
about_dialog = tk.Toplevel(self.root, bg=GUI_BG)
self.center_on_screen(about_dialog)
about_dialog.tk.call('wm', 'iconphoto', about_dialog._w, self.parent.icon)
about_dialog.minsize(250, 200)
about_dialog.geometry("250x200")
about_dialog.title('About ' + self.root.title())
about_dialog.bind('<Escape>', lambda event: about_dialog.destroy())
opencv_text = self.root.title() + " is created by: \n- Nathan de Bruijn (natdebru)"
re3_text = "\n\nRe3 is created by: \n- Daniel Gordon (danielgordon10)\n- Ali Farhadi\n- Dieter Fox"
cmt_text = "\n\nCMT is created by: \n- Georg Nebehay (gnebehay)\n- Roman Pflugfelder"
message_text = opencv_text + re3_text + cmt_text
tk.Message(about_dialog, text=message_text, bg=GUI_BG, width=300).pack(fill="x", side="top", padx=10, pady=10)
# function to center popup windows
示例6: create_path
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def create_path(self):
width_msg = 100
width_path = 400
path_frame = tkinter.Frame(self.root)
path_frame.pack(fill=X)
# read
read_frame = tkinter.Frame(path_frame)
read_frame.pack(fill=X)
read_msg = tkinter.Message(read_frame, width=width_msg, text='Video path:')
read_msg.pack(side=LEFT)
read_path = tkinter.Message(read_frame, width=width_path, text='file1')
read_path.pack(side=LEFT)
read_btn = tkinter.Button(read_frame, text="Choose file", command=self.click_read)
read_btn.pack(side=RIGHT)
# save
save_frame = tkinter.Frame(path_frame)
save_frame.pack(fill=X)
save_msg = tkinter.Message(save_frame, width=width_msg, text='Save to:')
save_msg.pack(side=LEFT)
save_path = tkinter.Message(save_frame, width=width_path, text='file2')
save_path.pack(side=LEFT)
save_btn = tkinter.Button(save_frame, text="Choose file", command=self.click_save)
save_btn.pack(side=RIGHT)
self.read_path = read_path
self.save_path = save_path
示例7: _init_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def _init_widgets(self):
self._canvas = tk.Canvas(self,
bg=self._conf.color_bg,
width=self._conf.map_width,
height=self._conf.map_height,
highlightthickness=0)
self._canvas.pack(side=tk.LEFT)
if self._conf.show_info_panel:
self._info_var = tk.StringVar()
frm = tk.Frame(self, bg=self._conf.color_bg)
frm.pack(side=tk.RIGHT, anchor=tk.N)
tk.Message(frm,
textvariable=self._info_var,
fg=self._conf.color_txt,
bg=self._conf.color_bg,
font=self._conf.font_info).pack(side=tk.TOP, anchor=tk.W)
scale = tk.Scale(frm,
font=self._conf.font_info,
fg=self._conf.color_txt,
bg=self._conf.color_bg,
highlightthickness=0,
from_=self._conf.interval_draw_max,
to=0,
orient=tk.HORIZONTAL,
length=self._conf.window_width - self._conf.map_width,
showvalue=False,
tickinterval=0,
resolution=1,
command=self._update_speed)
scale.pack(side=tk.TOP, anchor=tk.W)
scale.set(self._conf.interval_draw)
示例8: body
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def body(self, parent):
self._message = tkinter.Message(parent, text=self._text, aspect=400)
self._message.pack(expand=1, fill=tkinter.BOTH)
self._list = tkinter.Listbox(parent)
self._list.pack(expand=1, fill=tkinter.BOTH, side=tkinter.TOP)
for item in self._items:
self._list.insert(tkinter.END, item)
return self._list
示例9: _buttonbox
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Message [as 别名]
def _buttonbox(msg, title, choices, root=None, timeout=None):
"""
Display a msg, a title, and a set of buttons.
The buttons are defined by the members of the choices list.
Return the text of the button that the user selected.
@arg msg: the msg to be displayed.
@arg title: the window title
@arg choices: a list or tuple of the choices to be displayed
"""
global boxRoot, __replyButtonText, __widgetTexts, buttonsFrame
# Initialize __replyButtonText to the first choice.
# This is what will be used if the window is closed by the close button.
__replyButtonText = choices[0]
if root:
root.withdraw()
boxRoot = tk.Toplevel(master=root)
boxRoot.withdraw()
else:
boxRoot = tk.Tk()
boxRoot.withdraw()
boxRoot.title(title)
boxRoot.iconname("Dialog")
boxRoot.geometry(rootWindowPosition)
boxRoot.minsize(400, 100)
# ------------- define the messageFrame ---------------------------------
messageFrame = tk.Frame(master=boxRoot)
messageFrame.pack(side=tk.TOP, fill=tk.BOTH)
# ------------- define the buttonsFrame ---------------------------------
buttonsFrame = tk.Frame(master=boxRoot)
buttonsFrame.pack(side=tk.TOP, fill=tk.BOTH)
# -------------------- place the widgets in the frames -----------------------
messageWidget = tk.Message(messageFrame, text=msg, width=400)
messageWidget.configure(font=(PROPORTIONAL_FONT_FAMILY, PROPORTIONAL_FONT_SIZE))
messageWidget.pack(side=tk.TOP, expand=tk.YES, fill=tk.X, padx="3m", pady="3m")
__put_buttons_in_buttonframe(choices)
# -------------- the action begins -----------
# put the focus on the first button
__firstWidget.focus_force()
boxRoot.deiconify()
if timeout is not None:
boxRoot.after(timeout, timeoutBoxRoot)
boxRoot.mainloop()
try:
boxRoot.destroy()
except tk.TclError:
if __replyButtonText != TIMEOUT_RETURN_VALUE:
__replyButtonText = None
if root:
root.deiconify()
return __replyButtonText