Python ttk.Frame() Examples

The following are 30 code examples of ttk.Frame(). 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: annotation_gui.py    From SEM with MIT License 9 votes vote down vote up
def preferences(self, event=None):
        preferenceTop = tkinter.Toplevel()
        preferenceTop.focus_set()
        
        notebook = ttk.Notebook(preferenceTop)
        
        frame1 = ttk.Frame(notebook)
        notebook.add(frame1, text='general')
        frame2 = ttk.Frame(notebook)
        notebook.add(frame2, text='shortcuts')

        c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
        c.pack()
        
        shortcuts_vars = []
        shortcuts_gui = []
        cur_row = 0
        j = -1
        frame_list = []
        frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
        frame_list[-1].pack(fill="both", expand="yes")
        for i, shortcut in enumerate(self.shortcuts):
            j += 1
            key, cmd, bindings = shortcut
            name, command = cmd
            shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
            tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
            entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
            entry.grid(row=cur_row, column=1)
            cur_row += 1
        notebook.pack()
    
    #
    # ? menu methods
    # 
Example #2
Source File: components.py    From SEM with MIT License 8 votes vote down vote up
def __init__(self, root, resource_dir):
        ttk.Frame.__init__(self, root)
        
        self.master_selector = None
        self.resource_dir = resource_dir
        self.items = os.listdir(os.path.join(self.resource_dir, "master"))
        
        self.cur_lang = tkinter.StringVar()
        self.select_lang_label = ttk.Label(root, text=u"select language:")
        self.langs = ttk.Combobox(root, textvariable=self.cur_lang)
        
        self.langs["values"] = self.items

        self.langs.current(0)
        for i, item in enumerate(self.items):
            if item == "fr":
                self.langs.current(i)
        
        self.langs.bind("<<ComboboxSelected>>", self.select_lang) 
Example #3
Source File: builderWindow.py    From universalSmashSystem with GNU General Public License v3.0 6 votes vote down vote up
def addSubaction(self,_subaction):
        global action
        global frame
        
        group_to_action = {'Current Frame': action.actions_at_frame[frame],
                         'Set Up': action.set_up_actions,
                         'Tear Down': action.tear_down_actions,
                         'Transitions': action.state_transition_actions,
                         'Before Frames': action.actions_before_frame,
                         'After Frames': action.actions_after_frame,
                         'Last Frame': action.actions_at_last_frame}
        group = self.parent.action_selector_panel.current_group.get()
        if group_to_action.has_key(group) or group.startswith('Cond:'):
            subact = _subaction()
            if group.startswith('Cond:'):
                action.conditional_actions[group[6:]].append(subact)
            else: group_to_action[group].append(subact)
            self.root.actionModified()
            #self.parent.subaction_panel.addSubactionPanel(subact) 
Example #4
Source File: builderWindow.py    From universalSmashSystem with GNU General Public License v3.0 6 votes vote down vote up
def changeFrame(self, *_args):
        global frame
        
        self.unselect()
        
        self.current_frame_subacts = []
        for subact in action.actions_at_frame[frame]:
            self.current_frame_subacts.append(subact)
        if self.parent.action_selector_panel.current_group.get() == 'Current Frame':
            self.clearSubActList()
            for subact in self.current_frame_subacts:
                selector = subactionSelector.SubactionSelector(self.scroll_frame,subact)
                selector.subaction = subact
                selector.updateName()
                self.subaction_list.append(selector)
            self.showSubactionList() 
Example #5
Source File: builderWindow.py    From universalSmashSystem with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self,_parent,_root):
        BuilderPanel.__init__(self, _parent, _root)
        self.config(bg="purple",height=50)
        
        #Create Action dropdown menu
        self.current_action = StringVar(self)
        self.current_action.set("Fighter Properties")
        self.current_action.trace('w', self.changeActionDropdown)
        self.act_list = ['Fighter Properties']
        self.action = OptionMenu(self,self.current_action,*self.act_list)
        
        #Create Group dropdown menu
        self.current_group = StringVar(self)
        self.current_group.set("SetUp")
        self.default_group_list = ["Properties","Current Frame","Set Up","Tear Down","Transitions","Before Frames","After Frames","Last Frame"] 
        self.group_list = self.default_group_list[:] #have to do this to copy be value instead of reference
        self.group = OptionMenu(self,self.current_group,*self.group_list) 
Example #6
Source File: builderWindow.py    From universalSmashSystem with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self,_parent,_root):
        BuilderPanel.__init__(self, _parent, _root)
        self.config(bg="white",height=50)
        
        self.frame_changer_panel = Frame(self)
        
        self.button_minus_five = Button(self.frame_changer_panel, text="-5", command=lambda:self.changeFrameNumber(-5),state=DISABLED)
        self.button_minus = Button(self.frame_changer_panel, text="-1", command=lambda:self.changeFrameNumber(-1),state=DISABLED)
        self.current_frame = Label(self.frame_changer_panel,text="0/1",state=DISABLED)
        self.button_plus = Button(self.frame_changer_panel, text="+1", command=lambda:self.changeFrameNumber(1),state=DISABLED)
        self.button_plus_five = Button(self.frame_changer_panel, text="+5", command=lambda:self.changeFrameNumber(5),state=DISABLED)
        
        self.frame_changer_panel.pack()
        
        self.button_minus_five.grid(row=0,column=0)
        self.button_minus.grid(row=0,column=1)
        self.current_frame.grid(row=0,column=2)
        self.button_plus.grid(row=0,column=3)
        self.button_plus_five.grid(row=0,column=4) 
Example #7
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 6 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack(padx=20, pady=20)

        self.master = master

        self.selection = tk.StringVar()
        self.selection.set('white')

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

        tk.Radiobutton(self, text='White', value='white', variable=self.selection, command=self.set_color).pack(anchor='w')

        tk.Radiobutton(self, text='Red', value='red', variable=self.selection, command=self.set_color).pack(anchor='w')

        tk.Radiobutton(self, text='Green', value='green', variable=self.selection, command=self.set_color).pack(anchor='w')

        tk.Radiobutton(self, text='Blue', value='blue', variable=self.selection, command=self.set_color).pack(anchor='w') 
Example #8
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 6 votes vote down vote up
def __init__(self, master):
        ttk.Frame.__init__(self, master)
        self.pack()

        ttk.Label(self, text="This is an 'indeterminate' progress bar").pack(padx=20, pady=10)

        progress1 = ttk.Progressbar(self, orient='horizontal', length=500, mode='indeterminate')
        progress1.pack(padx=20, pady=10)

        ttk.Label(self, text="This is a 'determinate' progress bar").pack(padx=20, pady=10)

        progress2 = ttk.Progressbar(self, orient='horizontal', length=500, mode='determinate')
        progress2.pack(padx=20, pady=10)

        progress1.start()
        progress2.start() 
Example #9
Source File: createHitbox.py    From universalSmashSystem with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self,_parent):
        dataSelector.dataLine.__init__(self, _parent, _parent.interior, 'Create Hitbox')
        
        self.hitbox = None
        
        self.name_data = StringVar()
        self.name_entry = Entry(self,textvariable=self.name_data)
        
        self.hitboxPropertiesPanel = ttk.Notebook(self)
        
        self.properties_frame = HitboxPropertiesFrame(self.hitboxPropertiesPanel)
        self.damage_frame = HitboxDamageFrame(self.hitboxPropertiesPanel)
        self.charge_frame = HitboxChargeFrame(self.hitboxPropertiesPanel)
        override_frame = ttk.Frame(self.hitboxPropertiesPanel)
        autolink_frame = ttk.Frame(self.hitboxPropertiesPanel)
        funnel_frame = ttk.Frame(self.hitboxPropertiesPanel)
        
        self.hitboxPropertiesPanel.add(self.properties_frame,text="Properties")
        self.hitboxPropertiesPanel.add(self.damage_frame,text="Damage")
        self.hitboxPropertiesPanel.add(self.charge_frame,text="Charge")
        
        self.name_data.trace('w', self.changeVariable) 
Example #10
Source File: edit_dialog.py    From Enrich2 with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def body(self, master):
        """
        Add the UI elements to the edit window. Ordering and placement of UI 
        elements in columns is defined by the ``element_layouts`` dictionary.
        """
        main = ttk.Frame(master, padding=(3, 3, 12, 12))
        main.grid(row=0, column=0, sticky="nsew")

        layout = element_layouts[type(self.element).__name__]
        for i, column_tuple in enumerate(layout):
            new_frame = ttk.Frame(master, padding=(3, 3, 12, 12))
            new_frame.grid(row=0, column=i, sticky="nsew")
            row_no = 0
            for row_frame_key in layout[i]:
                for ui_element in self.frame_dict[row_frame_key]:
                    row_no += ui_element.body(new_frame, row_no, left=True)
        if "fastq" in self.frame_dict:
            if self.element.counts_file is not None:
                self.toggle.rb_counts.invoke()
            else:
                self.toggle.rb_fastq.invoke() 
Example #11
Source File: streams.py    From convis with GNU General Public License v3.0 6 votes vote down vote up
def mainloop(self):
        try:
            import Tkinter as tk
        except ImportError:
            import tkinter as tk
        from PIL import Image, ImageTk
        from ttk import Frame, Button, Style
        import time
        import socket
        self.root = tk.Toplevel() #Tk()
        self.root.title('Display')
        self.image = Image.fromarray(np.zeros((200,200))).convert('RGB')
        self.image1 = ImageTk.PhotoImage(self.image)
        self.panel1 = tk.Label(self.root, image=self.image1)
        self.display = self.image1
        self.frame1 = Frame(self.root, height=50, width=50)
        self.panel1.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
        self.root.after(100, self.advance_image)
        self.root.after(100, self.update_image)
        self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
        #global _started_tkinter_main_loop
        #if not _started_tkinter_main_loop:
        #    _started_tkinter_main_loop = True
        #    print("Starting Tk main thread...") 
Example #12
Source File: viewer.py    From minecart with MIT License 6 votes vote down vote up
def __init__(self, master=None, cnf=None, **kwargs):
        self.frame = ttk.Frame(master)
        self.frame.grid_rowconfigure(0, weight=1)
        self.frame.grid_columnconfigure(0, weight=1)
        self.xbar = AutoScrollbar(self.frame, orient=tkinter.HORIZONTAL)
        self.xbar.grid(row=1, column=0,
                       sticky=tkinter.E + tkinter.W)
        self.ybar = AutoScrollbar(self.frame)
        self.ybar.grid(row=0, column=1,
                       sticky=tkinter.S + tkinter.N)
        tkinter.Canvas.__init__(self, self.frame, cnf or {},
                                xscrollcommand=self.xbar.set,
                                yscrollcommand=self.ybar.set,
                                **kwargs)
        tkinter.Canvas.grid(self, row=0, column=0,
                            sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S)
        self.xbar.config(command=self.xview)
        self.ybar.config(command=self.yview)
        self.bind("<MouseWheel>", self.on_mousewheel) 
Example #13
Source File: tkk_tab.py    From PCWG with MIT License 6 votes vote down vote up
def demo():
    root = tk.Tk()
    root.title("ttk.Notebook")

    nb = ttk.Notebook(root)

    # adding Frames as pages for the ttk.Notebook 
    # first page, which would get widgets gridded into it
    page1 = ttk.Frame(nb)

    # second page
    page2 = ttk.Frame(nb)

    nb.add(page1, text='One')
    nb.add(page2, text='Two')

    nb.pack(expand=1, fill="both")

    root.mainloop() 
Example #14
Source File: grid_box.py    From PCWG with MIT License 6 votes vote down vote up
def _set_up_tree_widget(self):

        tree_container = ttk.Frame(self.container)

        tree_container.grid(row=0, column=0, sticky=tk.W+tk.E+tk.N+tk.S)

        #tree_container.pack(fill='both', expand=True)

        # create a treeview with dual scrollbars
        self.tree = ttk.Treeview(tree_container, columns=self.headers, show="headings")
        
        vsb = ttk.Scrollbar(tree_container, orient="vertical", command=self.tree.yview)
        hsb = ttk.Scrollbar(tree_container, orient="horizontal", command=self.tree.xview)

        self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
        self.tree.grid(column=0, row=0, sticky='nsew')

        vsb.grid(column=1, row=0, sticky='ns')
        hsb.grid(column=0, row=1, sticky='ew')

        tree_container.grid_columnconfigure(0, weight=1)
        tree_container.grid_rowconfigure(0, weight=1)

        self.tree.bind("<Double-1>", self.double_click) 
Example #15
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):
        ttk.Frame.__init__(self, master)
        self.pack()

        options = ['Minneapolis', 'Eau Claire', 'Cupertino', 'New York', 'Amsterdam', 'Sydney', 'Hong Kong']

        ttk.Label(self, text="This is a combobox").pack(pady=10)

        self.combo = ttk.Combobox(self, values=options, state='readonly')
        self.combo.current(0)
        self.combo.pack(padx=15)

        ttk.Button(self, text='OK', command=self.ok).pack(side='right', padx=15, pady=10) 
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(padx=20, pady=20)

        self.master = master

        options = ['white', 'red', 'green', 'blue']

        self.selection = tk.StringVar()
        self.selection.set('White')

        tk.Label(self, text="This is an optionmenu").pack()

        tk.OptionMenu(self, self.selection, *[x.capitalize() for x in options], command=self.set_color).pack() 
Example #17
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 #18
Source File: date_decoder.py    From Learning-Python-for-Forensics-Second-Edition with MIT License 5 votes vote down vote up
def build_output_frame(self):
        """
        The build_output_frame method builds the interface for
        the output frame
        """
        # Output Frame Init
        self.output_frame = ttk.Frame(self.root)
        self.output_frame.config(height=300, width=500)
        self.output_frame.pack()

        # Output Area
        ## Label for area
        self.output_label = ttk.Label(self.output_frame,
            text="Conversion Results")
        self.output_label.config(font=("", 16))
        self.output_label.pack(fill=X)

        ## For Unix Seconds Timestamps
        self.unix_sec = ttk.Label(self.output_frame,
            text="Unix Seconds: N/A")
        self.unix_sec.pack(fill=X)

        ## For Windows FILETIME 64 Timestamps
        self.win_ft_64 = ttk.Label(self.output_frame,
            text="Windows FILETIME 64: N/A")
        self.win_ft_64.pack(fill=X)

        ## For Chrome Timestamps
        self.google_chrome = ttk.Label(self.output_frame,
            text="Google Chrome: N/A")
        self.google_chrome.pack(fill=X) 
Example #19
Source File: builderWindow.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def changeFrame(self, *_args):
        global frame
        
        if self.root.action_string.get() == self.action_name: #if our action is selected
            print('Change Frame',frame,self.action)
            self.currentFrameGroup.clearChildren()
            self.currentFrameGroup.childElements = []
            for subact in self.action.actions_at_frame[frame]:
                self.currentFrameGroup.childElements.append(subact.getDataLine(self))
            self.currentFrameGroup.childElements.append(dataSelector.NewSubactionLine(self,self.interior))
        
            self.last_known_frame = self.root.frame.get() #update our last known frame 
Example #20
Source File: plot.py    From evo_slam with GNU General Public License v3.0 5 votes vote down vote up
def tabbed_tk_window(self):
        from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
        import sys
        if sys.version_info[0] < 3:
            import Tkinter as tkinter
            import ttk
        else:
            import tkinter
            from tkinter import ttk
        self.root_window = tkinter.Tk()
        self.root_window.title(self.title)
        # quit if the window is deleted
        self.root_window.protocol("WM_DELETE_WINDOW", self.root_window.quit)
        nb = ttk.Notebook(self.root_window)
        nb.grid(row=1, column=0, sticky='NESW')
        for name, fig in self.figures.items():
            fig.tight_layout()
            tab = ttk.Frame(nb)
            canvas = FigureCanvasTkAgg(self.figures[name], master=tab)
            canvas.draw()
            canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                        expand=True)
            toolbar = NavigationToolbar2Tk(canvas, tab)
            toolbar.update()
            canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                  expand=True)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            nb.add(tab, text=name)
        nb.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True)
        self.root_window.mainloop()
        self.root_window.destroy() 
Example #21
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 #22
Source File: test_widgets.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def create(self, **kwargs):
        return ttk.Frame(self.root, **kwargs) 
Example #23
Source File: builderWindow.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,_parent):
        Frame.__init__(self, _parent, bg="blue")
        self.root = _parent
        
        self.data_panel = SidePanel(self,self.root)
        
        self.data_panel.pack(fill=BOTH,expand=TRUE) 
Example #24
Source File: createHitbox.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,_parent):
        ttk.Frame.__init__(self,_parent)
        self.hitbox = None
        
        self.validateFloat = (_parent.register(self.validateFloat),
                '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W')
        
        self.charge_damage_label = Label(self,text="Charge Damage:")
        self.charge_damage_data = IntVar()
        self.charge_damage_entry = Spinbox(self,from_=0,to=999,textvariable=self.charge_damage_data,width=4)
        
        self.charge_base_label = Label(self,text="Charge Base Knockback:")
        self.charge_base_data = StringVar()
        self.charge_base_entry = Entry(self,textvariable=self.charge_base_data,validate='key',validatecommand=self.validateFloat)
        
        self.charge_growth_label = Label(self,text="Charge Knockback Growth:")
        self.charge_growth_data = StringVar()
        self.charge_growth_entry = Entry(self,textvariable=self.charge_growth_data,validate='key',validatecommand=self.validateFloat)
        
        self.charge_damage_label.grid(row=0,column=0,sticky=E)
        self.charge_damage_entry.grid(row=0,column=1,sticky=W)
        
        self.charge_base_label.grid(row=1,column=0,sticky=E)
        self.charge_base_entry.grid(row=1,column=1,sticky=W)
        
        self.charge_growth_label.grid(row=2,column=0,sticky=E)
        self.charge_growth_entry.grid(row=2,column=1,sticky=W) 
Example #25
Source File: createHitbox.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,_parent):
        ttk.Frame.__init__(self,_parent)
        self.hitbox = None
        
        self.validateFloat = (_parent.register(self.validateFloat),
                '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W')
        
        self.damage_label = Label(self,text="Damage:")
        self.damage_data = IntVar()
        self.damage_entry = Spinbox(self,from_=0,to=999,textvariable=self.damage_data,width=4)
        
        self.base_label = Label(self,text="Base Knockback:")
        self.base_data = StringVar()
        self.base_entry = Entry(self,textvariable=self.base_data,validate='key',validatecommand=self.validateFloat)
        
        self.growth_label = Label(self,text="Knockback Growth:")
        self.growth_data = StringVar()
        self.growth_entry = Entry(self,textvariable=self.growth_data,validate='key',validatecommand=self.validateFloat)
        
        self.trajectory_label = Label(self,text="Trajectory:")
        self.trajectory_data = IntVar()
        self.trajectory_entry = Spinbox(self,from_=0,to=360,textvariable=self.trajectory_data,width=4)
        
        self.hitstun_label = Label(self,text="Hitstun Multiplier:")
        self.hitstun_data = StringVar()
        self.hitstun_entry = Entry(self,textvariable=self.hitstun_data,validate='key',validatecommand=self.validateFloat)
        
        self.damage_label.grid(row=0,column=0,sticky=E)
        self.damage_entry.grid(row=0,column=1,sticky=W)
        
        self.base_label.grid(row=1,column=0,sticky=E)
        self.base_entry.grid(row=1,column=1,sticky=W)
        
        self.growth_label.grid(row=2,column=0,sticky=E)
        self.growth_entry.grid(row=2,column=1,sticky=W)
        
        self.trajectory_label.grid(row=3,column=0,sticky=E)
        self.trajectory_entry.grid(row=3,column=1,sticky=W)
        
        self.hitstun_label.grid(row=4,column=0,sticky=E)
        self.hitstun_entry.grid(row=4,column=1,sticky=W) 
Example #26
Source File: createHitbox.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def update(self):
        ttk.Frame.update(self)
        if self.hitbox:
            self.type_data.set(self.hitbox.type)
            self.lock_data.set(self.hitbox.hitbox_lock)
            self.center_x_data.set(self.hitbox.center[0])
            self.center_y_data.set(self.hitbox.center[1])
            self.size_x_data.set(self.hitbox.size[0])
            self.size_y_data.set(self.hitbox.size[1]) 
Example #27
Source File: createHitbox.py    From universalSmashSystem with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,_parent):
        ttk.Frame.__init__(self,_parent)
        self.hitbox = None
        
        self.type_label = Label(self,text="Type:")
        self.type_data = StringVar()
        self.type_entry = Entry(self,textvariable=self.type_data)#OptionMenu() ###
        
        self.lock_label = Label(self,text="Lock:")
        self.lock_data = StringVar()
        self.lock_entry = Entry(self,textvariable=self.lock_data)
        
        self.center_label = Label(self,text="Center:")
        self.center_x_data = IntVar()
        self.center_x_entry = Spinbox(self,from_=-255,to=255,textvariable=self.center_x_data,width=4)
        self.center_y_data = IntVar()
        self.center_y_entry = Spinbox(self,from_=-255,to=255,textvariable=self.center_y_data,width=4)
        
        self.size_label = Label(self,text="Size:")
        self.size_x_data = IntVar()
        self.size_x_entry = Spinbox(self,from_=-255,to=255,textvariable=self.size_x_data,width=4)
        self.size_y_data = IntVar()
        self.size_y_entry = Spinbox(self,from_=-255,to=255,textvariable=self.size_y_data,width=4)
        
        self.type_label.grid(row=0,column=0,sticky=E)
        self.type_entry.grid(row=0,column=1,columnspan=2)
        
        self.lock_label.grid(row=1,column=0,sticky=E)
        self.lock_entry.grid(row=1,column=1,columnspan=2)
        
        self.center_label.grid(row=2,column=0,sticky=E)
        self.center_x_entry.grid(row=2,column=1)
        self.center_y_entry.grid(row=2,column=2)
        
        self.size_label.grid(row=3,column=0,sticky=E)
        self.size_x_entry.grid(row=3,column=1)
        self.size_y_entry.grid(row=3,column=2) 
Example #28
Source File: plot.py    From evo with GNU General Public License v3.0 5 votes vote down vote up
def tabbed_tk_window(self):
        from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
        import sys
        if sys.version_info[0] < 3:
            import Tkinter as tkinter
            import ttk
        else:
            import tkinter
            from tkinter import ttk
        self.root_window = tkinter.Tk()
        self.root_window.title(self.title)
        # quit if the window is deleted
        self.root_window.protocol("WM_DELETE_WINDOW", self.root_window.quit)
        nb = ttk.Notebook(self.root_window)
        nb.grid(row=1, column=0, sticky='NESW')
        for name, fig in self.figures.items():
            fig.tight_layout()
            tab = ttk.Frame(nb)
            canvas = FigureCanvasTkAgg(self.figures[name], master=tab)
            canvas.draw()
            canvas.get_tk_widget().pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                        expand=True)
            toolbar = NavigationToolbar2Tk(canvas, tab)
            toolbar.update()
            canvas._tkcanvas.pack(side=tkinter.TOP, fill=tkinter.BOTH,
                                  expand=True)
            for axes in fig.get_axes():
                if isinstance(axes, Axes3D):
                    # must explicitly allow mouse dragging for 3D plots
                    axes.mouse_init()
            nb.add(tab, text=name)
        nb.pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True)
        self.root_window.mainloop()
        self.root_window.destroy() 
Example #29
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 #30
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()