Python tkinter.Message() Examples

The following are 13 code examples of tkinter.Message(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter , or try the search function .
Example #1
Source File: ticketbox.py    From hwk-mirror with GNU General Public License v3.0 7 votes vote down vote up
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 
Example #2
Source File: SikuliGui.py    From lackey with MIT License 5 votes vote down vote up
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() 
Example #3
Source File: SikuliGui.py    From lackey with MIT License 5 votes vote down vote up
def __init__(self, parent, msg, title, options, default, 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
        self.input_text.set(default)
        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_list = ttk.Combobox(
            self.parent,
            textvariable=self.input_text,
            state="readonly",
            values=options)
        #self.input_list.activate(options.index(default))
        self.input_list.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_list.focus_set() 
Example #4
Source File: SikuliGui.py    From lackey with MIT License 5 votes vote down vote up
def __init__(self, parent, message, title, lines, width, input_text):
        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 = input_text
        if Settings.PopupLocation:
            self.parent.geometry("+{}+{}".format(
                Settings.PopupLocation.x,
                Settings.PopupLocation.y))

        self.input_entry = TextExtension(
            self.parent,
            textvariable=self.input_text,
            width=width,
            height=lines)
        self.input_entry.grid(row=1, sticky="EW", padx=10, pady=10)

        self.msg = tk.Message(self.parent, text=message)
        self.msg.grid(row=0, sticky="NSEW", 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() 
Example #5
Source File: test_widgets.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Message(self.root, **kwargs) 
Example #6
Source File: gb_ide.py    From greenBerry with Apache License 2.0 5 votes vote down vote up
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 
Example #7
Source File: test_widgets.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Message(self.root, **kwargs) 
Example #8
Source File: top_menu.py    From OpenCV-Video-Label with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #9
Source File: test_widgets.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def create(self, **kwargs):
        return tkinter.Message(self.root, **kwargs) 
Example #10
Source File: gui.py    From OverwatchDataAnalysis with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #11
Source File: gui.py    From snake with MIT License 5 votes vote down vote up
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) 
Example #12
Source File: gui_04.py    From Modern-Python-Standard-Library-Cookbook with MIT License 5 votes vote down vote up
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 
Example #13
Source File: __init__.py    From PyMsgBox with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
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