Python ttk.Button() Examples

The following are 30 code examples of ttk.Button(). 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 ttk , or try the search function .
Example #1
Source File: tkinter_gui.py    From ChatterBot with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def initialize(self):
        """
        Set window layout.
        """
        self.grid()

        self.respond = ttk.Button(self, text='Get Response', command=self.get_response)
        self.respond.grid(column=0, row=0, sticky='nesw', padx=3, pady=3)

        self.usr_input = ttk.Entry(self, state='normal')
        self.usr_input.grid(column=1, row=0, sticky='nesw', padx=3, pady=3)

        self.conversation_lbl = ttk.Label(self, anchor=tk.E, text='Conversation:')
        self.conversation_lbl.grid(column=0, row=1, sticky='nesw', padx=3, pady=3)

        self.conversation = ScrolledText.ScrolledText(self, state='disabled')
        self.conversation.grid(column=0, row=2, columnspan=2, sticky='nesw', padx=3, pady=3) 
Example #2
Source File: cheetah_update.py    From cheetah-gui with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, top=None):
        """This class configures and populates the toplevel window.
           top is the toplevel containing window."""
        _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        _compcolor = '#d9d9d9'  # X11 color: 'gray85'
        _ana1color = '#d9d9d9'  # X11 color: 'gray85'
        self.style = ttk.Style()
        if sys.platform == "win32":
            self.style.theme_use('winnative')
        self.style.configure('.', background=_bgcolor)
        self.style.configure('.', foreground=_fgcolor)
        self.style.configure('.', font="TkDefaultFont")
        self.style.map('.', background=[('selected', _compcolor), ('active', _ana1color)])

        top.geometry("388x169+474+249")
        top.title("Cheetah Update")
        top.configure(background="#d9d9d9")
        top.configure(highlightbackground="#d9d9d9")
        top.configure(highlightcolor="black")

        self.TButton1 = ttk.Button(top)
        self.TButton1.place(relx=0.23, rely=0.71, height=27, width=87)
        self.TButton1.configure(command=cheetah_update_support.check_updates)
        self.TButton1.configure(takefocus="")
        self.TButton1.configure(textvariable=cheetah_update_support.check_update)

        self.Message1 = Message(top)
        self.Message1.place(relx=0.05, rely=0.12, relheight=0.44, relwidth=0.87)
        self.Message1.configure(background="#d9d9d9")
        self.Message1.configure(foreground="#000000")
        self.Message1.configure(highlightbackground="#d9d9d9")
        self.Message1.configure(highlightcolor="black")
        self.Message1.configure(textvariable=cheetah_update_support.update_msg)
        self.Message1.configure(width=337)

        self.TButton2 = ttk.Button(top)
        self.TButton2.place(relx=0.57, rely=0.71, height=27, width=87)
        self.TButton2.configure(command=cheetah_update_support.exit_update)
        self.TButton2.configure(takefocus="")
        self.TButton2.configure(text='''Cancel''') 
Example #3
Source File: annotation_gui.py    From SEM with MIT License 6 votes vote down vote up
def load_pipeline(self, event=None):
        top = tkinter.Toplevel()
        master_selector = SemTkMasterSelector(top, os.path.join(sem.SEM_DATA_DIR, "resources"))
        lang_selector = SemTkLangSelector(top, os.path.join(sem.SEM_DATA_DIR, "resources"))
        lang_selector.master_selector = master_selector
        vars_cur_row = 0
        vars_cur_row, _ = lang_selector.grid(row=vars_cur_row, column=0)
        vars_cur_row, _ = master_selector.grid(row=vars_cur_row, column=0)
        
        def cancel(event=None):
            if self.pipeline is not None:
                self.tag_document_btn.configure(state=tkinter.NORMAL)
            top.destroy()
        def ok(event=None):
            path = master_selector.workflow()
            pipeline, _, _, _ = sem.modules.tagger.load_master(path)
            self.pipeline = pipeline
            cancel()
        
        ok_btn = ttk.Button(top, text="load workflow", command=ok)
        ok_btn.grid(row=vars_cur_row, column=0)
        cancel_btn = ttk.Button(top, text="cancel", command=cancel)
        cancel_btn.grid(row=vars_cur_row, column=1) 
Example #4
Source File: __main__.py    From tkcalendar with GNU General Public License v3.0 6 votes vote down vote up
def example1():
    def print_sel():
        print(cal.selection_get())
        cal.see(datetime.date(year=2016, month=2, day=5))

    top = tk.Toplevel(root)

    import datetime
    today = datetime.date.today()

    mindate = datetime.date(year=2018, month=1, day=21)
    maxdate = today + datetime.timedelta(days=5)
    print(mindate, maxdate)

    cal = Calendar(top, font="Arial 14", selectmode='day', locale='en_US',
                   mindate=mindate, maxdate=maxdate, disabledforeground='red',
                   cursor="hand1", year=2018, month=2, day=5)
    cal.pack(fill="both", expand=True)
    ttk.Button(top, text="ok", command=print_sel).pack() 
Example #5
Source File: PluginOptions.py    From aurora-sdk-mac with Apache License 2.0 6 votes vote down vote up
def toggle_empty_state(self, show, addRow=True):
        if (show):
            self.root.minsize(width=0, height=260)
            self.root.maxsize(width=1200, height=260)
            self.emptyStateButton = ttk.Button(self.mainPluginFrame, text="Add Plugin Options", command=lambda: self.toggle_empty_state(False))
            self.emptyStateButton.grid(column=0, row=0, sticky=(N,W,E,S))
            if self.showingHeader:
                self.headerLabel.destroy()
                self.addButton.destroy()
                self.generateButton.destroy()
        else:
            self.root.minsize(width=0, height=380)
            self.root.maxsize(width=1200, height=380)
            self.showingHeader = True
            self.headerLabel = ttk.Label(self.mainPluginFrame, text="Plugin Options")
            self.headerLabel.grid(column=0, row=0, sticky=(N,W), pady=(0, 15))
            self.addButton = ttk.Button(self.mainPluginFrame, text='Add Plugin Option', command=self.add_plugin_option)
            self.addButton.grid(column=1, row=0, sticky=(N,E))
            self.generateButton = ttk.Button(self.mainPluginFrame, text='Generate Header', command=self.generate_plugin_options_header)
            self.generateButton.grid(column=2, row=0, sticky=(N,E))
            if self.emptyStateButton:
                if addRow:
                    self.add_plugin_option()
                self.emptyStateButton.destroy() 
Example #6
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        tk.Label(self, text="This is a normal text entry box").pack()

        self.entry = tk.Entry(self, bg='white')
        self.entry.pack()

        tk.Label(self, text="This is a secret text entry box for passwords").pack()

        self.secret_entry = tk.Entry(self, show='*', bg='white')
        self.secret_entry.pack()

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #7
Source File: dialog_elements.py    From Enrich2 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def body(self, master, row, columns=DEFAULT_COLUMNS, **kwargs):
        """
        Place the required elements using the grid layout method.

        Returns the number of rows taken by this element.
        """
        label = ttk.Label(master, text=self.text)
        label.grid(row=row, column=0, columnspan=1, sticky="e")
        self.entry = ttk.Entry(master, textvariable=self.value)
        self.entry.grid(row=row, column=1, columnspan=columns - 1, sticky="ew")
        if self.directory:
            self.choose = ttk.Button(
                master,
                text="Choose...",
                command=lambda: self.value.set(tkFileDialog.askdirectory()),
            )
        else:
            self.choose = ttk.Button(
                master,
                text="Choose...",
                command=lambda: self.value.set(tkFileDialog.askopenfilename()),
            )
        self.choose.grid(row=row + 1, column=1, sticky="w")
        if self.optional:
            self.clear = ttk.Button(
                master, text="Clear", command=lambda: self.value.set("")
            )
            self.clear.grid(row=row + 1, column=2, sticky="e")
        return 2 
Example #8
Source File: Controls.py    From Python-Media-Player with Apache License 2.0 5 votes vote down vote up
def create_control_panel(self):
        frame=Tkinter.LabelFrame(self.root)
        frame.pack(expand='yes',fill='x',side='top')
        add_fileicon=Tkinter.PhotoImage(file="../Icons/add_file.gif")
        add_directoryicon=Tkinter.PhotoImage(file="../Icons/add_directory.gif")
        exiticon=Tkinter.PhotoImage(file="../Icons/exit.gif")
        playicon=Tkinter.PhotoImage(file="../Icons/play.gif")
        pauseicon=Tkinter.PhotoImage(file="../Icons/pause.gif")
        stopicon=Tkinter.PhotoImage(file="../Icons/stop.gif")
        rewindicon=Tkinter.PhotoImage(file="../Icons/rewind.gif")
        fast_forwardicon=Tkinter.PhotoImage(file="../Icons/fast_forward.gif")
        previous_trackicon=Tkinter.PhotoImage(file="../Icons/previous_track.gif")
        next_trackicon=Tkinter.PhotoImage(file="../Icons/next_track.gif")
        self.muteicon=Tkinter.PhotoImage(file="../Icons/mute.gif")
        self.unmuteicon=Tkinter.PhotoImage(file="../Icons/unmute.gif")
        delete_selectedicon=Tkinter.PhotoImage(file="../Icons/delete_selected.gif")

        list_file=[
            (playicon,'self.play'),
            (pauseicon,'self.pause'),
            (stopicon,'self.stop'),
            (previous_trackicon,'self.previous'),
            (rewindicon,'self.rewind'),
            (fast_forwardicon,'self.fast'),
            (next_trackicon,'self.Next'),]
        for i,j in list_file:
            storeobj=ttk.Button(frame, image=i,command=eval(j))
            storeobj.pack(side='left')
            storeobj.image=i
        self.volume_label=Tkinter.Button(frame,image=self.unmuteicon)
        self.volume_label.image=self.unmuteicon
        
        volume=ttk.Scale(frame,from_=Volume_lowest_value, to=Volume_highest_value ,variable=self.var, command=self.update_volume)
        volume.pack(side='right', padx=10, )
        self.volume_label.pack(side='right')
        return 
Example #9
Source File: marmot.py    From aggregation with Apache License 2.0 5 votes vote down vote up
def __run__(self):
        # create the welcome window
        run_type = None
        t = tkinter.Toplevel(self.root)
        t.resizable(False,False)
        frame = ttk.Frame(t, padding="3 3 12 12")
        frame.grid(column=0, row=0, sticky=(tkinter.N, tkinter.W, tkinter.E, tkinter.S))
        frame.columnconfigure(0, weight=1)
        frame.rowconfigure(0, weight=1)
        ttk.Label(frame,text="Welcome to Marmot.").grid(column=1,row=1)
        def setup(require_gold_standard):
            # this will determine the whole run mode from here on in
            self.require_gold_standard = require_gold_standard
            self.subjects = self.__image_select__(require_gold_standard)
            # if r == "a":
            #     self.subjects = self.project.__get_retired_subjects__(1,True)
            #     self.run_mode = "a"
            # else:
            #     # when we want to explore subjects which don't have gold standard
            #     # basically creating some as we go
            #     # False => read in all subjects, not just those with gold standard annotations
            #     # todo - takes a while in read in all subjects. Better way?
            #     self.subjects = self.project.__get_retired_subjects__(1,False)
            #     self.run_mode = "b"
            random.shuffle(self.subjects)

            self.__thumbnail_display__()
            self.__add_buttons__()

            t.destroy()

        ttk.Button(frame, text="Explore results using existing expert annotations", command = lambda : setup(True)).grid(column=1, row=2)
        ttk.Button(frame, text="Explore and create gold standard on the fly", command = lambda : setup(False)).grid(column=1, row=3)

        t.lift(self.root)

        # self.outputButtons()
        self.root.mainloop() 
Example #10
Source File: marmot.py    From aggregation with Apache License 2.0 5 votes vote down vote up
def __thumbnail_display__(self):
        # destroy any previously existing thumbnails - for when we're flipping through pages
        for thumb_index in range(len(self.thumbnails)-1,-1,-1):
            old_thumb = self.thumbnails.pop(thumb_index)
            old_thumb.destroy()

        for ii,subject_id in enumerate(self.subjects[9*self.page_index:9+9*self.page_index]):
            # do we already have a thumb for this file?
            thumb_path = DIR_THUMBS+str(subject_id)+".jpg"
            if not os.path.exists(thumb_path):
                self.__create_thumb__(subject_id)

            render_image = ImageTk.PhotoImage(file=thumb_path)

            but = ttk.Button(self.root, image=render_image)
            but.grid(column=ii/3+1, row=(1+ii)%3,sticky=tkinter.W)

            # the interaction with the subject will depend on whether we have gold standard data for it or not
            # if not, the user will need to create some
            if self.require_gold_standard:
                assert False
                # but.bind('<Button-1>', lambda event,t=thumb_path: self.(t) if self.run_mode == "a" else self.__create_gold_standard__(t))
            else:
                but.bind('<Button-1>', lambda event,t=thumb_path: self.__create_gold_standard__(t))

            self.thumbnails.append(but)

            # sigh - I hate having to do this
            # MUST keep - otherwise garbage collection in Python will remove it
            self.links.append(render_image)

        # todo - this window is not actually popping up
        # determine which of the subjects we are interested in have actually been processed
        # we may need to do some additional aggregation
        aggregated_subjects = self.project.__get_aggregated_subjects__(-1)

        not_aggregated = [s for s in self.subjects[:self.step_size] if s not in aggregated_subjects]

        # print not_aggregated
        if not_aggregated != []:
            self.project.__aggregate__([-1],self.subjects[:self.step_size]) 
Example #11
Source File: marmot.py    From aggregation with Apache License 2.0 5 votes vote down vote up
def __add_buttons__(self):
        # for ii,thumbfile in enumerate(thumbfiles[:3]):

        ttk.Button(self.root, text="<--", command=self.__decrement__).grid(column=2, row=4)
        ttk.Button(self.root, text="-->", command=self.__increment__).grid(column=2, row=5)
        # ttk.Button(self.root, text="Threshold Plot", command=self.__calculate__).grid(column=1, row=5)
        # ttk.Button(self.root, text="Re-aggregate", command=self.__reaggregate__).grid(column=1, row=6)
        ttk.Button(self.root, text="ROC estimate", command=self.__roc_estimate__).grid(column=1, row=6) 
Example #12
Source File: sqlite_bro.py    From sqlite_bro with MIT License 5 votes vote down vote up
def create_toolbar(self):
        """create the toolbar of the application"""
        self.toolbar = Frame(self.tk_win, relief=RAISED)
        self.toolbar.pack(side=TOP, fill=X)
        self.tk_icon = self.get_tk_icons()

        # list of (image, action, tooltip) :
        to_show = [
           ('refresh_img', self.actualize_db, "Actualize databases"),
           ('run_img', self.run_tab, "Run script selection"),
           ('newtab_img', lambda x=self: x.n.new_query_tab("___", ""),
            "Create a new script"),
           ('csvin_img', self.import_csvtb, "Import a CSV file into a table"),
           ('csvex_img', self.export_csvtb,
            "Export selected table to a CSV file"),
           ('dbdef_img', self.savdb_script,
            "Save main database as a SQL script"),
           ('qryex_img', self.export_csvqr,
            "Export script selection to a CSV file"),
           ('exe_img', self.exsav_script,
            "Run script+output to a file (First 200 rec. per Qry)"),
           ('sqlin_img', self.load_script, "Load a SQL script file"),
           ('sqlsav_img', self.sav_script, "Save a SQL script in a file"),
           ('chgsz_img', self.chg_fontsize, "Modify font size")]

        for img, action, tip in to_show:
            b = Button(self.toolbar, image=self.tk_icon[img], command=action)
            b.pack(side=LEFT, padx=2, pady=2)
            self.createToolTip(b, tip) 
Example #13
Source File: test_tooltip.py    From tkcalendar with GNU General Public License v3.0 5 votes vote down vote up
def test_tooltipwrapper(self):
        b1 = ttk.Button(self.window, text='Button 1')
        b2 = tk.Button(self.window, text='Button 2')
        b1.pack()
        b2.pack()
        self.window.update()
        tw = TooltipWrapper(self.window, delay=1)
        tw.add_tooltip(b1, "tooltip 1")
        tw.add_tooltip(b2, "tooltip 2")
        self.window.update()

        def removal_tests():
            tw.remove_tooltip(self.window)
            tw.remove_tooltip(b1)
            self.window.update()
            b1.event_generate('<Enter>', x=0, y=0)
            self.window.update()
            self.assertIsNone(tw.current_widget)
            tw.remove_all()
            self.assertFalse(tw.widgets)

        def test_leave(button):
            button.event_generate('<Leave>', x=0, y=0)
            self.window.update()
            self.assertFalse(tw.tooltip.winfo_ismapped())
            self.assertIsNone(tw.current_widget)

        def test(button):
            button.event_generate('<Enter>', x=0, y=0)
            self.window.update()
            self.window.after(5, self.assertEqual(tw.current_widget, button))
            self.window.after(7, lambda: self.assertTrue(tw.tooltip.winfo_ismapped()))
            self.window.after(9, test_leave)

        test(b1)
        self.window.after(11, lambda: test(b2))
        self.window.after(22, removal_tests) 
Example #14
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        tk.Label(self, text="This is a button").pack()

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #15
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def test_invoke(self):
        success = []
        btn = ttk.Button(self.root, command=lambda: success.append(1))
        btn.invoke()
        self.assertTrue(success) 
Example #16
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        tk.Label(self, text="This is a listbox").pack()

        list_items = ["This is a listbox!", 'Item 1', 'Item 2', 'Item 3', 'etc.']

        self.listbox = tk.Listbox(self, selectmode='extended', bg='white')
        self.listbox.pack(padx=10, pady=10)

        for l in list_items:
            self.listbox.insert('end', l)

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #17
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        tk.Label(self, text="This is a text box").pack()

        text_frame = tk.Frame(self, borderwidth=1, relief='sunken')
        text_frame.pack(padx=10, pady=10)

        self.text = tk.Text(text_frame, width=30, height=4, wrap=tk.WORD)
        self.text.pack()

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #18
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        self.var1 = tk.IntVar()
        self.var2 = tk.IntVar()

        tk.Label(self, text="These are checkbuttons").pack()

        tk.Checkbutton(self, text='Pick me!', variable=self.var1, command=self.checked).pack()

        tk.Checkbutton(self, text='Or pick me!', variable=self.var2, command=self.checked).pack()

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #19
Source File: date_decoder.py    From Learning-Python-for-Forensics-Second-Edition with MIT License 5 votes vote down vote up
def build_input_frame(self):
        """
        The build_input_frame method builds the interface for
        the input frame
        """
        # Frame Init
        self.input_frame = ttk.Frame(self.root)
        self.input_frame.config(padding = (30,0))
        self.input_frame.pack()

        # Input Value
        ttk.Label(self.input_frame,
            text="Enter Time Value").grid(row=0, column=0)

        self.input_time = StringVar()
        ttk.Entry(self.input_frame, textvariable=self.input_time,
            width=25).grid(row=0, column=1, padx=5)

        # Radiobuttons
        self.time_type = StringVar()
        self.time_type.set('raw')

        ttk.Radiobutton(self.input_frame, text="Raw Value",
            variable=self.time_type, value="raw").grid(row=1,
                column=0, padx=5)

        ttk.Radiobutton(self.input_frame, text="Formatted Value",
            variable=self.time_type, value="formatted").grid(
                row=1, column=1, padx=5)

        # Button
        ttk.Button(self.input_frame, text="Run",
            command=self.convert).grid(
                row=2, columnspan=2, pady=5) 
Example #20
Source File: record.py    From TensorKart with MIT License 5 votes vote down vote up
def create_main_panel(self):
        # Panels
        top_half = tk.Frame(self.root)
        top_half.pack(side=tk.TOP, expand=True, padx=5, pady=5)
        message = tk.Label(self.root, text="(Note: UI updates are disabled while recording)")
        message.pack(side=tk.TOP, padx=5)
        bottom_half = tk.Frame(self.root)
        bottom_half.pack(side=tk.LEFT, padx=5, pady=10)

        # Images
        self.img_panel = tk.Label(top_half, image=ImageTk.PhotoImage("RGB", size=IMAGE_SIZE)) # Placeholder
        self.img_panel.pack(side = tk.LEFT, expand=False, padx=5)

        # Joystick
        self.init_plot()
        self.PlotCanvas = FigCanvas(figure=self.fig, master=top_half)
        self.PlotCanvas.get_tk_widget().pack(side=tk.RIGHT, expand=False, padx=5)

        # Recording
        textframe = tk.Frame(bottom_half, width=332, height=15, padx=5)
        textframe.pack(side=tk.LEFT)
        textframe.pack_propagate(0)
        self.outputDirStrVar = tk.StringVar()
        self.txt_outputDir = tk.Entry(textframe, textvariable=self.outputDirStrVar, width=100)
        self.txt_outputDir.pack(side=tk.LEFT)
        self.outputDirStrVar.set("samples/" + datetime.now().strftime('%Y-%m-%d_%H:%M:%S'))

        self.record_button = ttk.Button(bottom_half, text="Record", command=self.on_btn_record)
        self.record_button.pack(side = tk.LEFT, padx=5) 
Example #21
Source File: TkDrumMachine.py    From Tkinter-Projects with MIT License 5 votes vote down vote up
def create_left_pad(self):
		left_frame = Frame(self.root)
		left_frame.grid(row=10, column=0, columnspan=6, padx=10)
		tbicon = PhotoImage(file='images/openfile.gif')
		for i in range(0, MAX_DRUM_NUM):
			button = Button(left_frame, image=tbicon, command=self.drum_load(i))
			button.image = tbicon
			button.grid(row=i, column=0, padx=5, pady=2)
			self.drum_entry = Entry(left_frame)
			self.drum_entry.grid(row=i, column=1, padx=7, pady=2)
			self.widget_drum_name.append(self.drum_entry) 
Example #22
Source File: TkDrumMachine.py    From Tkinter-Projects with MIT License 5 votes vote down vote up
def create_right_pad(self):
		bpu = self.bpu.get()
		units = self.units.get()
		c = bpu * units
		self.playlist =[[0]*c for x in range(MAX_DRUM_NUM)]
		right_frame = Frame(self.root)
		right_frame.grid(row=10, column=6, sticky=E+W, padx=10, pady=2)
		self.button = [[0 for x in range(c)] for x in range(MAX_DRUM_NUM)]
		for i in range(MAX_DRUM_NUM):
			for j in range(c):
				color = 'grey55' if (j/bpu)%2 else 'khaki'
				self.button[i][j] = Button(right_frame, bg=color, width=1, command=self.button_clicked(i,j,bpu))
				self.button[i][j].grid(row=i, column=j) 
Example #23
Source File: TkDrumMachine.py    From Tkinter-Projects with MIT License 5 votes vote down vote up
def create_play_bar(self):
		playbar_frame = Frame(self.root)
		playbar_frame.grid(row=12, column=0,columnspan=13, sticky=W+E, padx=10, pady=5) 
		self.start_button = ttk.Button(playbar_frame, text='Play', command=self.play_in_threading)
		self.start_button.grid(row=0, column=0, padx=2, pady=2)
		button = ttk.Button(playbar_frame, text='Stop', command=self.stop_play)
		button.grid(row=0, column=1, padx=2, pady=2)
		loop = BooleanVar()
		loopbutton = ttk.Checkbutton(playbar_frame, text='Loop', variable=loop, command=lambda:self.loop_play(loop.get()))
		loopbutton.grid(row=0, column=2, padx=2, pady=2)
		photo = PhotoImage(file='images/sig.gif')
		label = Label(playbar_frame, image=photo)
		label.image = photo
		label.grid(row=0, column=3, padx=2, sticky=E) 
Example #24
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def setUp(self):
        super(WidgetTest, self).setUp()
        self.widget = ttk.Button(self.root, width=0, text="Text")
        self.widget.pack()
        self.widget.wait_visibility() 
Example #25
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.Button(self.root, **kwargs) 
Example #26
Source File: gui.py    From stochopy with MIT License 5 votes vote down vote up
def footer(self):
        # Run button
        run_button = ttk.Button(self.master, text = "Run", command = self.run)

        # Exit button
        exit_button = ttk.Button(self.master, text = "Exit", command = self.close_window)

        # Layout
        run_button.place(relwidth = 0.1, relx = 0.9, rely = 1, x = -5, y = -5, anchor = "se")
        exit_button.place(relwidth = 0.1, relx = 1, rely = 1, x = -5, y = -5, anchor = "se") 
Example #27
Source File: main.py    From aurora-sdk-mac with Apache License 2.0 5 votes vote down vote up
def show_window(self):
        self.mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        self.mainframe.columnconfigure(0, weight=1)
        self.mainframe.rowconfigure(0, weight=1)

        ttk.Label(self.mainframe, text="             ").grid(column=0, row=0, sticky=(N,W))
        ttk.Label(self.mainframe, text='1. Pair your Light Panels   ').grid(column=1, row=1, sticky=(N, W))
        ttk.Checkbutton(self.mainframe, variable=self.should_use_simulator, text='Use Light Panels Simulator', command=self.toggle_aurora_simulator).grid(column=2, row=1, sticky=(N,W))

        ttk.Label(self.mainframe, text='IP Address').grid(column=1, row=2, sticky=(N, W))
        self.pair_entry = ttk.Entry(self.mainframe, width=35, textvariable=self.ip_addr)
        self.pair_entry.grid(column=2, row=2, columnspan=2, sticky=(N, W))
        self.pair_button = ttk.Button(self.mainframe, width=12, text='Pair', command=self.authenticate_with_aurora)
        self.pair_button.grid(column=4, row=2, sticky=(N,W))

        ttk.Label(self.mainframe, text='2. Make a color palette').grid(column=1, row=3, sticky=(N, W))

        ttk.Button(self.mainframe, text="Add Color", command=self.add_color_to_palette).grid(column=1, row=4, sticky=(N, W))
        ttk.Label(self.mainframe, textvariable=self.curr_palette_string, wraplength=500).grid(column=2, row=4, columnspan=2, sticky=(N, W))
        ttk.Button(self.mainframe, width=12, text="Clear palette", command=self.clear_palette).grid(column=4, row=4, sticky=(N, W))

        ttk.Label(self.mainframe, text='3. Build your plugin').grid(column=1, row=5, sticky=(N, W))
        
        ttk.Label(self.mainframe, text='Plugin Location').grid(column=1, row=6, sticky=(N, W))
        ttk.Entry(self.mainframe, width=35, textvariable=self.plugin_dir_path).grid(column=2, row=6, columnspan=2, sticky=(N, W))
        ttk.Button(self.mainframe, width=12, text='Browse', command=self.get_plugin_dir).grid(column=4, row=6, sticky=(N, W))
    
        ttk.Button(self.mainframe, text='Build', command=self.build_plugin).grid(column=2, row=7, columnspan=1, sticky=(N,E))
        ttk.Button(self.mainframe, text='Upload & Run', command=self.play_plugin).grid(column=3, row=7, columnspan=1, sticky=N)
        ttk.Button(self.mainframe, width=12, text='Stop Plugin', command=self.stop_plugin).grid(column=4, row=7, columnspan=1, sticky=(N, W))

        ttk.Label(self.mainframe, text="             ").grid(column=5, row=8, sticky=(N,W))
        ttk.Label(self.mainframe, text="             ").grid(column=5, row=9, sticky=(N,W))

        self.pluginOptionsGUI.create_plugin_frame()

        self.root.mainloop() 
Example #28
Source File: PluginOptions.py    From aurora-sdk-mac with Apache License 2.0 5 votes vote down vote up
def create_bool_plugin_option_row(self, pluginOptionType, pluginOptionFrame, pluginOptionTypeVar, row=-1, defaultVal=1):
        if not self.plugin_option_is_type_bool(pluginOptionType):
            return

        ttk.Label(pluginOptionFrame, text='            ').grid(column=1, row=row)
        ttk.Label(pluginOptionFrame, text='            ').grid(column=2, row=row)
        ttk.Label(pluginOptionFrame, text='            ').grid(column=3, row=row)
        ttk.Label(pluginOptionFrame, text='            ').grid(column=4, row=row)
        ttk.Label(pluginOptionFrame, text='            ').grid(column=5, row=row)
        ttk.Label(pluginOptionFrame, text='Default Value:').grid(column=6, row=row, sticky=(E))
        pluginOptionDefaultValue = StringVar()
        pluginOptionDefaultValue.set(self.boolOptions[defaultVal])
        optionmenu = OptionMenu(pluginOptionFrame, pluginOptionDefaultValue, *self.boolOptions)
        optionmenu.grid(column=7, row=row, sticky=(W))
        # Known issue with MacOS TCL where the background color of ttk is not defined and different from the Tkinter background color
        operating_sys = sys.platform
        if operating_sys == "darwin":
            optionmenu.configure(background="#E4E4E4")

        pluginOptionRow = {
                            "rowFrame": pluginOptionFrame,
                            "optionTypeVar": pluginOptionTypeVar,
                            "optionDefaultVar": pluginOptionDefaultValue
                        }

        ttk.Button(pluginOptionFrame, text='Remove', command=lambda: self.remove_plugin_option(pluginOptionRow)).grid(column=8, row=row, sticky=(E))

        return pluginOptionRow 
Example #29
Source File: myNotebook.py    From EDMarketConnector with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, master=None, **kw):
        if platform == 'darwin':
            kw['highlightbackground'] = kw.pop('highlightbackground', PAGEBG)
            tk.Button.__init__(self, master, **kw)
        elif platform == 'win32':
            ttk.Button.__init__(self, master, style='nb.TButton', **kw)
        else:
            ttk.Button.__init__(self, master, **kw) 
Example #30
Source File: test_widgets.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_invoke(self):
        success = []
        btn = ttk.Button(self.root, command=lambda: success.append(1))
        btn.invoke()
        self.assertTrue(success)