當前位置: 首頁>>代碼示例>>Python>>正文


Python tkinter.Message方法代碼示例

本文整理匯總了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 
開發者ID:BnetButter,項目名稱:hwk-mirror,代碼行數:24,代碼來源:ticketbox.py

示例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() 
開發者ID:glitchassassin,項目名稱:lackey,代碼行數:34,代碼來源:SikuliGui.py

示例3: create

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import Message [as 別名]
def create(self, **kwargs):
        return tkinter.Message(self.root, **kwargs) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:4,代碼來源:test_widgets.py

示例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 
開發者ID:Abdur-rahmaanJ,項目名稱:greenBerry,代碼行數:13,代碼來源:gb_ide.py

示例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 
開發者ID:natdebru,項目名稱:OpenCV-Video-Label,代碼行數:17,代碼來源:top_menu.py

示例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 
開發者ID:appcell,項目名稱:OverwatchDataAnalysis,代碼行數:29,代碼來源:gui.py

示例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) 
開發者ID:chuyangliu,項目名稱:snake,代碼行數:38,代碼來源:gui.py

示例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 
開發者ID:PacktPublishing,項目名稱:Modern-Python-Standard-Library-Cookbook,代碼行數:10,代碼來源:gui_04.py

示例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 
開發者ID:asweigart,項目名稱:PyMsgBox,代碼行數:63,代碼來源:__init__.py


注:本文中的tkinter.Message方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。