コード例 #1
0
ファイル: 14_popup_menu.py プロジェクト: griadooss/HowTos
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Popup menu")
        self.menu = Menu(self.parent, tearoff=0)
        #A context menu is a regular Menu widget. 
        #The tearoff feature is turned off. 
        #Now it is not possible to separate the menu into a new toplevel window.
        self.menu.add_command(label="Beep", command=self.bell())
        self.menu.add_command(label="Exit", command=self.onExit)

        self.parent.bind("<Button-3>", self.showMenu)
        #We bind the <Button-3> event to the showMenu() method. 
        #The event is generated when we right click on the client area of the window.
        self.pack()
        
    #The showMenu() method shows the context menu. 
    #The popup menu is shown at the x and y coordinates of the mouse click.    
    def showMenu(self, e):
        self.menu.post(e.x_root, e.y_root)
       

    def onExit(self):
        self.quit()
コード例 #2
0
class GroupNameLabel(Label):
    """Label with group name"""

    def __init__(self, parent, group, **kw):
        self._group = group
        kw['text'] = str(group)
        #        kw.setdefault('anchor', 'w')
        kw.setdefault('font', tkFont.Font(size=20))
        Label.__init__(self, parent, **kw)
        self._init_menu()

    def _init_menu(self):
        self._menu = Menu(self, tearoff=0)
        self._menu.add_command(label="Copy LaTeX", command=self._copy_latex)

        # right button on Mac and other systems
        button = '2' if tools.IS_MAC else '3'
        self.bind("<Button-{}>".format(button), self._right_click)

    def _right_click(self, event):
        self._menu.post(event.x_root, event.y_root)

    def _copy_latex(self):
        pyperclip.setcb(self._group.str_latex())

    @property
    def group(self):
        return self._group

    @group.setter
    def group(self, group):
        self._group = group
        self['text'] = str(group)
コード例 #3
0
    def _init_menu(self):

        self._menubar = Menu(self._parent)
        menubar = self._menubar
        self._parent.config(menu=menubar)

        #new_menu = Menu(menubar, tearoff=0)
        #new_menu.add_command(label="Billiard Table", command=self.on_new_similarity_surface)

        file_menu = Menu(menubar, tearoff=0)
        #file_menu.add_cascade(label="New", menu=new_menu)
        file_menu.add_command(label="Octagon", command=self.add_octagon)
        file_menu.add_command(label="MegaWollmilchsau",
                              command=self.add_mega_wollmilchsau)
        file_menu.add_separator()
        file_menu.add_command(label="About", command=self.on_about)
        file_menu.add_command(label="Export PostScript",
                              command=self.on_export)
        file_menu.add_command(label="Exit",
                              command=self.exit,
                              accelerator="Alt+F4")
        menubar.add_cascade(label="File", underline=0, menu=file_menu)

        self._surface_menu = Menu(menubar, tearoff=0)
        self._selected_surface = IntVar()
        self._selected_surface.set(-1)
        menubar.add_cascade(label="Surface",
                            underline=0,
                            menu=self._surface_menu)
        self._surface_menu.add_radiobutton(label="None",
                                           command=self.menu_select_surface,
                                           variable=self._selected_surface,
                                           value=-1)
コード例 #4
0
    def initUI(self):
      
        self.parent.title("Simple CSV parser GUI")
        self.pack(fill=BOTH, expand=1)
        
        menu = Menu(self.parent)
        self.parent.config(menu=menu)
        
        filemenu = Menu(menu)
        menu.add_cascade(label="File"        , menu=filemenu)
        
        fileOpenMenu = Menu(filemenu)
        filemenu.add_cascade(label="Open..." , menu=fileOpenMenu)
        fileOpenMenu.add_command(label="CSV..." , command=self.open_reqCSVcommand)

        fileSaveMenu = Menu(filemenu)
        filemenu.add_cascade(label="Save..." , menu=fileSaveMenu)
        fileSaveMenu.add_command(label="CSV..." , command=self.save_reqCSVcommand)
        fileSaveMenu.add_command(label="DOX..." , command=self.save_reqDOXcommand)
        fileSaveMenu.add_command(label="MM..."  , command=self.save_reqMMcommand)
        
        filemenu.add_separator()
        filemenu.add_command(label="Exit"    , command=self.exit_command)
        
        helpmenu = Menu(menu)
        menu.add_cascade(label="Help"        , menu=helpmenu)
        helpmenu.add_command(label="About...", command=self.about_command)
        # end of menu creation       
        
        self.txt = Text(self)
        self.txt.pack(fill=BOTH, expand=1)
コード例 #5
0
ファイル: menu_bar.py プロジェクト: fmihaich/annic
def getValidationMenu(main_frame, menu_bar):
    menu = Menu(menu_bar, tearoff=0)

    menu.add_command(label='Confusion matrix',
                     command=main_frame.on_calculate_confusion_matrix)

    return menu
コード例 #6
0
ファイル: main.py プロジェクト: shish/context
 def file_menu():
     menu = Menu(menubar, tearoff=0)
     menu.add_command(label="Open ctxt / cbin", command=self.open_file)
     # menu.add_command(label="Append ctxt", command=self.append_file)
     menu.add_separator()
     menu.add_command(label="Exit", command=self.save_settings_and_quit)
     return menu
コード例 #7
0
ファイル: tree.py プロジェクト: aboSamoor/nltk
    def _init_menubar(self):
        menubar = Menu(self._top)

        filemenu = Menu(menubar, tearoff=0)
        filemenu.add_command(label='Print to Postscript', underline=0,
                             command=self._cframe.print_to_file,
                             accelerator='Ctrl-p')
        filemenu.add_command(label='Exit', underline=1,
                             command=self.destroy, accelerator='Ctrl-x')
        menubar.add_cascade(label='File', underline=0, menu=filemenu)

        zoommenu = Menu(menubar, tearoff=0)
        zoommenu.add_radiobutton(label='Tiny', variable=self._size,
                                 underline=0, value=10, command=self.resize)
        zoommenu.add_radiobutton(label='Small', variable=self._size,
                                 underline=0, value=12, command=self.resize)
        zoommenu.add_radiobutton(label='Medium', variable=self._size,
                                 underline=0, value=14, command=self.resize)
        zoommenu.add_radiobutton(label='Large', variable=self._size,
                                 underline=0, value=28, command=self.resize)
        zoommenu.add_radiobutton(label='Huge', variable=self._size,
                                 underline=0, value=50, command=self.resize)
        menubar.add_cascade(label='Zoom', underline=0, menu=zoommenu)

        self._top.config(menu=menubar)
コード例 #8
0
ファイル: toolbar.py プロジェクト: Exodus111/Projects
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("Toolbar")

        menubar = Menu(self.parent)
        self.fileMenu = Menu(self.parent, tearoff=0)
        self.fileMenu.add_command(label="Exit", command=self.onExit)
        menubar.add_cascade(label="File", menu=self.fileMenu)

        toolbar = Frame(self.parent, bd=1, relief=RAISED)

        self.img = Image.open("./img/exit.png")
        eimg = ImageTk.PhotoImage(self.img)

        exitButton = Button(toolbar, image=eimg, relief=FLAT, command=self.quit)
        exitButton.image = eimg
        exitButton.pack(side=LEFT, padx=2, pady=2)

        toolbar.pack(side=TOP, fill=X)
        self.parent.config(menu=menubar)
        self.pack()

    def onExit(self):
        self.quit()
コード例 #9
0
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        #<create the rest of your GUI here>
        parent.title("PhoneBook")
        parent.geometry("400x400+100+140")
        """
        self.toolbar = Toolbar(self)
        self.toolbar.pack(side="top", fill="x")
        """
        #Adaugarea meniu barului
        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)
        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Exit", command=self.quit)
        menubar.add_cascade(label="File", menu=fileMenu)

        helpAbout = Menu(menubar)
        helpAbout.add_command(label="About")
        menubar.add_cascade(label="Help", menu=helpAbout)
        """
        #adaugarea toolbarului
        self.toolBar = tk.Toplevel(self.parent, bd=1, relief=RAISED)
        self.btnExit = Button(self.toolBar, relief=FLAT, command=self.quit)
        self.btnExit.pack(side=LEFT, padx=2, pady=2)
        self.toolBar(side=TOP, fill=X)
        """
        Label(self.parent, text="Nume/Prenume: ").pack()
        entNumePrenume = Entry(self.parent).pack() 
        
        self.pack()
コード例 #10
0
ファイル: menu_bar.py プロジェクト: fmihaich/annic
def getValidationMenu(main_frame, menu_bar):
    menu = Menu(menu_bar, tearoff=0)

    menu.add_command(label = 'Confusion matrix', 
                     command = main_frame.on_calculate_confusion_matrix)
    
    return menu
コード例 #11
0
ファイル: tkinter_popup.py プロジェクト: siwells/sandpit
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Popup menu")
        self.menu = Menu(self.parent, tearoff=0)
        self.menu.add_command(label="Beep", command=self.bell())
        self.menu.add_command(label="Exit", command=self.onExit)

        self.parent.bind("<Button-2>", self.showMenu)
        self.pack()
        
        
    def showMenu(self, e):
        self.menu.post(e.x_root, e.y_root)
       

    def onExit(self):
        self.quit()
コード例 #12
0
 def _setup_menu(self, parent):
   present = set()
   robot_power_needed = True
   for drawable in self.board.get_drawables():
     if isinstance(drawable, Robot_IO_Drawable) and (drawable.group_id ==
         self.group_id):
       present.add(drawable.name)
     elif isinstance(drawable, Robot_Power_Drawable) and (drawable.group_id ==
         self.group_id):
       robot_power_needed = False
   if robot_power_needed or len(present) < 5:
     menu = Menu(parent, tearoff=0)
     def readd():
       n = 0
       if robot_power_needed:
         self.board.add_drawable(Robot_Power_Drawable(self.color,
             self.group_id), self.offset)
         n += 1
       for name in ['Ai1', 'Ai2', 'Ai3', 'Ai4', 'Vo']:
         if name not in present:
           self.board.add_drawable(Robot_IO_Drawable(name, self.color,
               self.group_id), self.offset)
           n += 1
       if n > 1:
         self.board._action_history.combine_last_n(n)
     menu.add_command(label='Re-add Missing Parts', command=readd)
     return menu
コード例 #13
0
    def _init_menu(self):
        """Init menu bar content.
        """
        toplevel = self.winfo_toplevel()
        if toplevel['menu']:
            self._menu = self.nametowidget(name=toplevel['menu'])
        else:
            self._menu = Menu(toplevel)
            toplevel['menu'] = self._menu

        graph_options = Menu(self._menu, tearoff=0)
        self._menu.add_cascade(label="Graph", menu=graph_options)
        self._menu_index = self._menu.index("end")

        vertex_label_position_menu = Menu(graph_options, tearoff=0)
        graph_options.add_cascade(label="Label position",
                                  menu=vertex_label_position_menu)

        menu_var = self.winfo_name() + ".vertexlabelposition"
        vertex_label_position_menu.add_radiobutton(variable=menu_var,
                                                   label="Auto",
                                                   value="auto")
        vertex_label_position_menu.add_radiobutton(variable=menu_var,
                                                   label="Center",
                                                   value="center")

        graph_options.add_command(label="Save graph...",
                                  command=self.call_graph_save_dialog)

        self.bind("<Destroy>", self.__destroy_menu)
コード例 #14
0
    def initUI(self):

        self.parent.title("File dialog")

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Open", command=self.onOpen)
        menubar.add_cascade(label="File", menu=fileMenu)        
        self.style = Style()
        self.style.theme_use("default")        

        global frame1
        frame1 = Frame()
        frame1.grid(row=0, column=0, sticky='w')

        l1 = Label(frame1, text='CSV file name', relief=RIDGE, width=20)
        l1.grid(row=4, column=0)
        
        l2 = Label(frame1, text='SCR file name', relief=RIDGE, width=20)
        l2.grid(row=5, column=0)
        
        inform = Button(frame1, text="Choose CSV file", command=self.onCSVfile)
        inform.grid(row=1, column=0)

        self.file_opt = options = {}
        options['defaultextension'] = '.csv'
        options['filetypes'] = [('CSV files', '.csv'), ('all files', '.*')]
コード例 #15
0
ファイル: pgmenubuilder.py プロジェクト: popgengui/negui
	def __add_menu_item( self, o_config, s_menu_label ):

		#this will be the menu labeled s_menu_label (ex: "File" menu)
		#and the command items (like "Open" or "Save""Save") are then added
		#to this item using the o_config objects options:
		o_this_menu = Menu( self.__menubar, tearoff = self.__tearoff ) 

		ld_args = self.get_add_command_params_and_args(  o_config, s_menu_label )

		for d_args in ld_args:
			if d_args[ "label" ] == "sep":
				o_this_menu.add_separator()
			else:
				o_this_menu.add_command( **d_args )
			#end if seperator, else sub menu
		#end for each set of args

		dv_menu_values = self.__get_menu_values( o_config, s_menu_label )

		s_accel = dv_menu_values[ "accelerator" ] if dv_menu_values[ "accelerator" ] is not None  else None

		self.__menubar.add_cascade( label = s_menu_label, 
			menu = o_this_menu, 
			underline=dv_menu_values[ "underline" ],
			accelerator=s_accel )
		return
コード例 #16
0
ファイル: t_test4.py プロジェクト: alonsopg/tkinter_examples
    def startUI(self):

        self.files = os.listdir(os.getcwd())

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Exit", command=self.quit)

        menubar.add_cascade(label="File", menu=fileMenu)

        listbox = Listbox(self.parent, selectmode=SINGLE)
        listbox.pack(fill=BOTH, expand=1)
        # listbox.insert(END, 'bebs')
        for i in self.files:
            listbox.insert(END, i)

        listbox.grid(column=0, columnspan=4, row=0, rowspan=10, sticky=N+S+E+W)


        txt = Text(self.parent)
        txt.grid(column=6, columnspan=8, row=0, rowspan=10, sticky=N+S+E+W)
        # txt.pack(fill=BOTH, expand=1)

        oBtn = Button(text="Open->", command=lambda: self.readContents(listbox, txt))

        oBtn.grid(column=5, row=3)
コード例 #17
0
class GUI_MoveRelativeTool:
    def __init__(self, master, distance):
        self.master = master
        self.master.title('Tools')
        self.createWidgets()
        self.set(distance)

    def callback(self, cb):
        self._callback = cb

    def do_callback(self, context, *args):
        if hasattr(self, '_callback'):
            self._callback(context, *args)

    def createWidgets(self):

        self.mainmenu = Menu(self.master)
        self.mainmenu.config(borderwidth=1)
        self.master.config(menu=self.mainmenu)

        self.filemenu = Menu(self.mainmenu)
        self.filemenu.config(tearoff=0)
        self.mainmenu.add_cascade(label='File',
                                  menu=self.filemenu,
                                  underline=0)
        self.filemenu.add_command(label='Apply', command=self.wApplyCB)
        self.filemenu.add_command(label='Cancel', command=self.wCancelCB)

        self.master.grid_rowconfigure(0, weight=1)
        self.master.grid_columnconfigure(0, weight=1)

        w = wFrame = LabelFrame(self.master, text='Move relative')

        w.grid(row=0, column=0, sticky=NSEW, padx=5, pady=5)
        w.grid_columnconfigure(0, weight=0)
        w.grid_columnconfigure(1, weight=1)

        w = Label(wFrame, text='Distance (mm) :', anchor=E)
        w.grid(row=0, column=0, sticky=NSEW)

        w = self.wDistance = XFloatEntry(wFrame,
                                         bg='white',
                                         width=10,
                                         borderwidth=2,
                                         justify=LEFT)
        w.grid(row=0, column=1, sticky=NSEW)
        w.callback(self.wEnterCB)
        w.enable_color(enable=False)

    def wApplyCB(self):
        self.do_callback(APPLY, self.wDistance.get() * mm_to_m)

    def wEnterCB(self, *args):
        self.do_callback(ENTER, self.wDistance.get() * mm_to_m)

    def wCancelCB(self):
        self.do_callback(CANCEL)

    def set(self, distance):
        self.wDistance.set(round(distance * m_to_mm, 1))
コード例 #18
0
    def init_ui(self):
        self.connections = {}
        self.button_frame = Frame(self)
        self.button_frame.grid(row=0, column=0, columnspan=2)
        self.map_frame = Frame(self)
        self.map_frame.grid(row=1, column=0, padx=5, pady=5, sticky=N + S + E + W)
        self.picker_frame = Frame(self)
        self.picker_frame.grid(row=1, column=1)

        self.button_new = Button(self.button_frame)
        self.button_new["text"] = "New"
        self.button_new["command"] = self.new_map
        self.button_new.grid(row=0, column=0, padx=2)

        self.menubar = Menu(self)

        menu = Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="File", menu=menu)
        menu.add_command(label="New")
        menu.add_command(label="Open")
        menu.add_command(label="Save")

        self.open = Button(self.button_frame)
        self.open["text"] = "Open"
        self.open["command"] = self.open_map
        self.open.grid(row=0, column=1, padx=2)

        self.save = Button(self.button_frame)
        self.save["text"] = "Save"
        self.save["command"] = self.save_map
        self.save.grid(row=0, column=2, padx=2)

        self.get_map_list()
        self.map_list.grid(row=0, column=3, padx=2)
コード例 #19
0
    def __init__(self, namespace):
        Tk.__init__(self, className="Koshka")

        self.dac = DAC()
        self.dac.start()

        self.score_path = namespace.score

        self.sequencer = None
        self.sequencer_frame = None
        self.mixer_window = None
        self.scale_window = None
        self._open_score(self.score_path)

        menu = Menu(self)
        self.config(menu=menu)
        filemenu = Menu(menu)
        menu.add_cascade(label="File", menu=filemenu)
        filemenu.add_command(label="Open...", command=self.open, accelerator="meta-o")
        filemenu.add_command(label="Save", command=self.save, accelerator="meta-s")
        filemenu.add_command(label="Save As...", command=self.save_as, accelerator="meta-shift-s")
        filemenu.add_separator()
        filemenu.add_command(label="Exit", command=self.quit)

        menu.add_cascade(label="Help", menu=filemenu)
        filemenu.add_command(label="Online Help...", command=lambda: webbrowser.open_new_tab(URL_HELP_DOC))

        # Note: This is only implemented and tested for Mac OS
        self.bind_all("<Command-o>", self.open)
        self.bind_all("<Command-s>", self.save)
        self.bind_all("<Command-Shift-s>", self.save_as)
        self.bind_all("<Meta-o>", self.open)
        self.bind_all("<Meta-s>", self.save)
        self.bind_all("<Meta-Shift-s>", self.save_as)
コード例 #20
0
class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
      
        self.parent.title("Popup menu")
        self.menu = Menu(self.parent, tearoff=0)
        self.menu.add_command(label="Beep", command=self.bell())
        self.menu.add_command(label="Exit", command=self.onExit)

        self.parent.bind("<Button-3>", self.showMenu)
        self.pack()
        
        
    def showMenu(self, e):
        self.menu.post(e.x_root, e.y_root)
       

    def onExit(self):
        self.quit()
コード例 #21
0
    def _init_menu(self):
        
        self._menubar = Menu(self._parent)
        menubar=self._menubar
        self._parent.config(menu=menubar)
        
        #new_menu = Menu(menubar, tearoff=0)
        #new_menu.add_command(label="Billiard Table", command=self.on_new_similarity_surface)
        
        file_menu = Menu(menubar, tearoff=0)
        #file_menu.add_cascade(label="New", menu=new_menu)
        file_menu.add_command(label="Octagon", command=self.add_octagon)
        file_menu.add_command(label="MegaWollmilchsau", command=self.add_mega_wollmilchsau)
        file_menu.add_separator()
        file_menu.add_command(label="About", command=self.on_about)
        file_menu.add_command(label="Export PostScript", command=self.on_export)
        file_menu.add_command(label="Exit", command=self.exit, accelerator="Alt+F4")
        menubar.add_cascade(label="File", underline=0, menu=file_menu)

        self._surface_menu = Menu(menubar, tearoff=0)
        self._selected_surface = IntVar()
        self._selected_surface.set(-1)
        menubar.add_cascade(label="Surface", underline=0, menu=self._surface_menu)
        self._surface_menu.add_radiobutton(label="None", 
            command=self.menu_select_surface, variable=self._selected_surface, 
            value=-1)
コード例 #22
0
 def _setup_menu(self, parent):
   if not self.group_id:
     # this is a stand alone motor, not part of a head
     return None
   motor_pot_needed = True
   photosensors_needed = True
   for drawable in self.board.get_drawables():
     if isinstance(drawable, Motor_Pot_Drawable) and (drawable.group_id ==
         self.group_id):
       motor_pot_needed = False
     elif isinstance(drawable, Photosensors_Drawable) and (drawable.group_id ==
         self.group_id):
       photosensors_needed = False
   if motor_pot_needed or photosensors_needed:
     menu = Menu(parent, tearoff=0)
     def readd():
       if motor_pot_needed:
         self.board.add_drawable(Motor_Pot_Drawable(self.color, self.group_id),
             self.offset)
       if photosensors_needed:
         self.board.add_drawable(Photosensors_Drawable(self.color,
           self.group_id, lambda: self.board.set_changed(True)), self.offset)
       if motor_pot_needed and photosensors_needed:
         self.board._action_history.combine_last_n(2)
     menu.add_command(label='Re-add Missing Parts', command=readd)
     return menu
コード例 #23
0
    def init_ui(self):
        self.connections = {}
        self.button_frame = Frame(self)
        self.button_frame.grid(row=0, column=0, columnspan=2)
        self.map_frame = Frame(self)
        self.map_frame.grid(row=1, column=0, padx=5, pady=5, sticky=N+S+E+W)
        self.picker_frame = Frame(self)
        self.picker_frame.grid(row=1, column=1)

        self.button_new = Button(self.button_frame)
        self.button_new["text"] = "New"
        self.button_new["command"] = self.new_map
        self.button_new.grid(row=0, column=0, padx=2)

        self.menubar = Menu(self)

        menu = Menu(self.menubar, tearoff=0)
        self.menubar.add_cascade(label="File", menu=menu)
        menu.add_command(label="New")
        menu.add_command(label="Open")
        menu.add_command(label="Save")

        self.open = Button(self.button_frame)
        self.open["text"] = "Open"
        self.open["command"] = self.open_map
        self.open.grid(row=0, column=1, padx=2)

        self.save = Button(self.button_frame)
        self.save["text"] = "Save"
        self.save["command"] = self.save_map
        self.save.grid(row=0, column=2, padx=2)

        self.get_map_list()
        self.map_list.grid(row=0, column=3, padx=2)
コード例 #24
0
        def __addComponents(components, node):
            componentlist = self.nodelist[node]['componentlist']
            ComponentMenu = self.nodelist[node]['menu']

            for comp in components:
                self.loginfo("Adding component '%s@%s'" % (comp, node))
                if self.autoscan.get() and comp not in componentlist:
                    self.scancomponent(comp, node)
                FuncMenu = Menu(ComponentMenu)
                FuncMenu.add_command(
                    label="Scan",
                    command=lambda
                    (name, node)=(comp, node): self.scancomponent(name, node))
                FuncMenu.add_command(
                    label="Copy Name",
                    command=lambda name=comp: self.copystring(name))
                FuncMenu.add_command(
                    label="Compose...",
                    command=lambda
                    (name, node)=(comp, node): self.composeMessage(name, node))
                FuncMenu.add_separator()
                FuncMenu = Menu(ComponentMenu)

                ComponentMenu.add_cascade(label=comp, menu=FuncMenu)
                componentlist[comp] = {'menu': FuncMenu}
コード例 #25
0
class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()

    def initUI(self):

        self.parent.title("Toolbar")

        menubar = Menu(self.parent)
        self.fileMenu = Menu(self.parent, tearoff=0)
        self.fileMenu.add_command(label="Exit", command=self.onExit)
        menubar.add_cascade(label="File", menu=self.fileMenu)

        toolbar = Frame(self.parent, bd=1, relief=RAISED)

        self.img = Image.open("exit.png")
        eimg = ImageTk.PhotoImage(self.img)

        exitButton = Button(toolbar,
                            image=eimg,
                            relief=FLAT,
                            command=self.quit)
        exitButton.image = eimg
        exitButton.pack(side=LEFT, padx=2, pady=2)

        toolbar.pack(side=TOP, fill=X)
        self.parent.config(menu=menubar)
        self.pack()

    def onExit(self):
        self.quit()
コード例 #26
0
ファイル: tree.py プロジェクト: sp00/nltk
    def _init_menubar(self):
        menubar = Menu(self._top)

        filemenu = Menu(menubar, tearoff=0)
        filemenu.add_command(label='Print to Postscript', underline=0,
                             command=self._cframe.print_to_file,
                             accelerator='Ctrl-p')
        filemenu.add_command(label='Exit', underline=1,
                             command=self.destroy, accelerator='Ctrl-x')
        menubar.add_cascade(label='File', underline=0, menu=filemenu)

        zoommenu = Menu(menubar, tearoff=0)
        zoommenu.add_radiobutton(label='Tiny', variable=self._size,
                                 underline=0, value=10, command=self.resize)
        zoommenu.add_radiobutton(label='Small', variable=self._size,
                                 underline=0, value=12, command=self.resize)
        zoommenu.add_radiobutton(label='Medium', variable=self._size,
                                 underline=0, value=14, command=self.resize)
        zoommenu.add_radiobutton(label='Large', variable=self._size,
                                 underline=0, value=28, command=self.resize)
        zoommenu.add_radiobutton(label='Huge', variable=self._size,
                                 underline=0, value=50, command=self.resize)
        menubar.add_cascade(label='Zoom', underline=0, menu=zoommenu)

        self._top.config(menu=menubar)
コード例 #27
0
class GroupNameLabel(Label):
    """Label with group name"""
    def __init__(self, parent, group, **kw):
        self._group = group
        kw['text'] = str(group)
        #        kw.setdefault('anchor', 'w')
        kw.setdefault('font', tkFont.Font(size=20))
        Label.__init__(self, parent, **kw)
        self._init_menu()

    def _init_menu(self):
        self._menu = Menu(self, tearoff=0)
        self._menu.add_command(label="Copy LaTeX", command=self._copy_latex)

        # right button on Mac and other systems
        button = '2' if tools.IS_MAC else '3'
        self.bind("<Button-{}>".format(button), self._right_click)

    def _right_click(self, event):
        self._menu.post(event.x_root, event.y_root)

    def _copy_latex(self):
        pyperclip.setcb(self._group.str_latex())

    @property
    def group(self):
        return self._group

    @group.setter
    def group(self, group):
        self._group = group
        self['text'] = str(group)
コード例 #28
0
 def __init__(self, root):
     Menu.__init__(self, root)
     menu_about = Menu(self, tearoff=0)
     menu_about.add_command(label=u"说明", command=self.showIntro)
     menu_about.add_command(label=u"关于", command=self.showAbout)
     self.add_command(label=u"部署", command=self.showDeploy)
     self.add_cascade(label=u"帮助", menu=menu_about)
コード例 #29
0
ファイル: taskmenu.py プロジェクト: patel-nikhil/pycards
def _create_optionmenu(menubar):
    """Create the cascading Option menu"""
    optionMenu = Menu(menubar, tearoff=0)
    menubar.add_cascade(label="Options", menu=optionMenu)
    optionMenu.add_command(label="Cardset", command=action.select_cardset)
    optionMenu.add_command(
        label="Background",
        command=lambda args=menubar.master: action.select_tile(args))
コード例 #30
0
ファイル: webimagecrawlerUI.py プロジェクト: SanniZ/ByPy
    def create_file_list_popmenu(self):
        fs_popmenu = Menu(self._wm['top'], tearoff=0)
        fs_popmenu.add_command(command=self.on_popmenu_fs_open,
                               label='%s' % LANG_MAP[self._lang]['Open'])
        # bind leave event
        fs_popmenu.bind("<Leave>", self.on_popmenu_fs_leave)

        self._wm['fs_popmenu'] = fs_popmenu
コード例 #31
0
 def toc_menu(self, text):
     "Create table of contents as drop-down menu."
     toc = Menubutton(self, text='TOC')
     drop = Menu(toc, tearoff=False)
     for lbl, dex in text.parser.toc:
         drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex))
     toc['menu'] = drop
     return toc
コード例 #32
0
 def _setup_menu(self, parent):
   def command():
     self.toggle_jfet()
     self.board.set_changed(True, Action(self.toggle_jfet, self.toggle_jfet,
         'toggle_jfet'))
   menu = Menu(parent, tearoff=0)
   menu.add_command(label='Toggle JFET', command=command)
   return menu
コード例 #33
0
 def toc_menu(self, text):
     "Create table of contents as drop-down menu."
     toc = Menubutton(self, text='TOC')
     drop = Menu(toc, tearoff=False)
     for lbl, dex in text.parser.toc:
         drop.add_command(label=lbl, command=lambda dex=dex:text.yview(dex))
     toc['menu'] = drop
     return toc
コード例 #34
0
    def initUI(self):
        self.parent.title("Simple Menu")

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu()
        fileMenu.add_command(label="Exit", command=self.onExit)
        menubar.add_cascade(label="file", menu=fileMenu)
コード例 #35
0
    def initUI(self):
        self.parent.title("Simple Menu")

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Exit", command=self.onExit)
        menubar.add_cascade(label="File", menu=fileMenu)
コード例 #36
0
ファイル: inventarioGUI.py プロジェクト: friveroll/Inventario
    def initUI(self):
        self.parent.title("Inventario")
        
        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Cerrar", command=self.Close)
        menubar.add_cascade(label="File", menu=fileMenu)
コード例 #37
0
ファイル: menuBar.py プロジェクト: Akanoa/CAI2014
    def __init__(self, parent=None):
         Frame.__init__(self, borderwidth=2)
         mButtonFile = Menubutton(self, text="Fichier")
         mButtonFile.pack()
         menuFile = Menu(mButtonFile)

         menuFile.add_command(label="Quitter", command=parent.quit)
         menuFile.add_command(label="Sauvegarder", command=parent.save)
         mButtonFile.configure(menu=menuFile)
コード例 #38
0
 def __init__(self, parent, *args, **kwargs):
     tk.Frame.__init__(self, parent, *args, **kwargs)
     self.parent = parent
     #<create the rest of your GUI here>
     menubar = Menu(self.parent)
     self.parent.config(menu=menubar)
     fileMenu = Menu(menubar)
     fileMenu.add_command(label="Exit", command=self.quit)
     menubar.add_cascade(label="File", menu=fileMenu)
コード例 #39
0
ファイル: editorpage.py プロジェクト: 8848/Pymol-script-repo
    def __make_rmenu(self):
        rmenu = Menu(self.text, tearoff=False)

        for label, eventname in self.rmenu_specs:
            def command(text=self.text, eventname=eventname):
                text.event_generate(eventname)
            rmenu.add_command(label=label, command=command)

        self.rmenu = rmenu
コード例 #40
0
ファイル: pyroller.py プロジェクト: prophittcorey/PyRoller
 def set_up_menu(self):
     ''' Sets up the menu bar and its submenus '''
     menubar = Menu(self.root)
     filemenu = Menu(menubar, tearoff=0)
     filemenu.add_command(label="About", command=self.about)
     filemenu.add_separator()
     filemenu.add_command(label="Exit", command=self.root.quit)
     menubar.add_cascade(label="File", menu=filemenu)
     self.root.config(menu=menubar)
コード例 #41
0
ファイル: ihm.py プロジェクト: dorianleveque/S7-CAI
 def __init__(self, parent=None):
     Frame.__init__(self, borderwidth=2)
     button_file = Menubutton(self, text="File")
     menu_file = Menu(button_file)
     menu_file.add_command(label="New", command=parent.new)
     menu_file.add_command(label="Save", command=parent.save)
     menu_file.add_command(label="Exit", command=parent.exit)
     button_file.configure(menu=menu_file)
     button_file.pack()
コード例 #42
0
ファイル: widgets.py プロジェクト: hrchu/mtx-gui
 def onRightClick(self, event):
     if self.slot.status == 'Full ':
         popup = Menu(self,tearoff=0)
         popup.add_command(label= u'load',
                     command=partial(self.menu_action, self.slot.slot))
         try:
             popup.tk_popup(event.x_root, event.y_root, 0)
         finally:
             popup.grab_release()
             self.updated()
コード例 #43
0
def main():
    root.title('XOX Game with Tkinter')

    menubar = Menu(root)
    menubar.add_command(label="NEW GAME", command=start)
    menubar.add_command(label="EXIT", command=root.quit)

    root.config(menu=menubar)
    start()
    mainloop()
コード例 #44
0
ファイル: webimagecrawlerUI.py プロジェクト: SanniZ/ByPy
    def create_path_popmenu(self):
        path_popmenu = Menu(self._wm['top'], tearoff=0)
        path_popmenu.add_command(command=self.on_popmenu_path_copy,
                                 label='%s' % LANG_MAP[self._lang]['Copy'])
        path_popmenu.add_command(command=self.on_popmenu_path_paste,
                                 label='%s' % LANG_MAP[self._lang]['Paste'])
        # bind leave event
        path_popmenu.bind("<Leave>", self.on_popmenu_path_leave)

        self._wm['path_popmenu'] = path_popmenu
コード例 #45
0
def main():
    root.title('XOX Game with Tkinter')

    menubar = Menu(root)
    menubar.add_command(label="NEW GAME", command=start)
    menubar.add_command(label="EXIT", command=root.quit)

    root.config(menu=menubar)
    start()
    mainloop()
コード例 #46
0
 def __add_menu(self):
     menubar = Menu(self.__main_window)
     file_menu = Menu(menubar, tearoff=0)
     file_menu.add_command(label="New", command=self.__menu_new_pressed)
     file_menu.add_command(label="Save", command=self.__menu_save_pressed)
     file_menu.add_command(label="Save As..",
                           command=self.__menu_save_as_pressed)
     file_menu.add_command(label="Load", command=self.__menu_load_pressed)
     file_menu.add_command(label="Exit")
     menubar.add_cascade(label="File", menu=file_menu)
     self.__main_window.config(menu=menubar)
コード例 #47
0
ファイル: Chess.py プロジェクト: LilCheabs/Chess
        def set_up_GUI():
            menuBar = Menu(self)
            self.master.config(menu=menuBar)
            fileMenu = Menu(menuBar, tearoff=0)
            menuBar.add_cascade(label="File", menu=fileMenu)
            fileMenu.add_command(label="New", command=self.new_game)
            fileMenu.add_command(label="Exit", command=self.exit)
            fileMenu.insert_separator(fileMenu.index(END))

            self.labelframe = Frame(self.master)
            self.labelframe.grid(column=0, row=0, sticky="W", padx=13)
コード例 #48
0
    def __make_rmenu(self):
        rmenu = Menu(self.text, tearoff=False)

        for label, eventname in self.rmenu_specs:

            def command(text=self.text, eventname=eventname):
                text.event_generate(eventname)

            rmenu.add_command(label=label, command=command)

        self.rmenu = rmenu
コード例 #49
0
    def __init__(self):
        root = Tk()
        root.title('FINDME3')
        root.geometry()
        self.root = root
        self.ini = 0
        self.ACC = np.zeros((len(names), ))
        self.trained = [False for i in names]
        self.outliers = [[] for i in names]
        choose = [self._choose(i) for i in range(9)]
        label1 = Label(root, text="input ontology:")
        label2 = Label(root, text="LIMIT:")
        entry1 = Entry(root, bd=5)
        entry2 = Entry(root, bd=3)
        menubar_method = Menu(root, bd=0)
        menusub = Menu(menubar_method, tearoff=0)
        for i in range(len(names)):
            menusub.add_command(label=names[i], command=choose[i])
        menubar_method.add_cascade(label='Method', menu=menusub)
        button1_1 = Button(root, command=self.cin, text='run')
        button1_2 = Button(root, command=self.root.destroy, text='exit')
        button1_3 = Button(root, command=self.available, text='Available')
        button1_4 = Button(root, command=self.train, text='Train&Test')
        button1_5 = Button(root, command=self.listall, text='List all ACC')
        button1_6 = Button(root,
                           command=self.outlier,
                           text='List outliers\n of this method')
        text1 = Text(root,
                     yscrollcommand=True,
                     xscrollcommand=True,
                     wrap='none')
        scr1_1 = Scrollbar(root)
        scr1_2 = Scrollbar(root, orient=HORIZONTAL)
        scr1_1['command'] = text1.yview
        scr1_2['command'] = text1.xview

        text1.configure(yscrollcommand=scr1_1.set, xscrollcommand=scr1_2.set)
        self.configs={'label1':label1\
                      ,'label2':label2\
                      ,'entry1':entry1\
                      ,'entry2':entry2\
                      ,'button1_1':button1_1\
                      ,'button1_2':button1_2\
                      ,'button1_3':button1_3\
                      ,'button1_4':button1_4\
                      ,'button1_5':button1_5\
                      ,'button1_6':button1_6\
                      ,'text1':text1\
                      ,'scr1_1':scr1_1\
                      ,'scr1_2':scr1_2\
                      ,'menu':menubar_method}
        self.display1()
        self.root.config(menu=menubar_method)
コード例 #50
0
def setup_menu(main_window):
    global mw
    mw = main_window

    menubar = Menu(mw)

    helpmenu = Menu(menubar, tearoff=0)
    helpmenu.add_command(label="Keyboard Control", command=show_keyboard_control_dialog)
    helpmenu.add_command(label="About", command=show_about_dialog)
    menubar.add_cascade(label="Help", menu=helpmenu)

    mw.config(menu=menubar)
コード例 #51
0
    def __init__(self):
        root = Tk()
        root.title("split data")
        root.geometry("200x200")
        menu = Menu(root)
        root.config(menu=menu)
        filemenu = Menu(menu)
        menu.add_cascade(label="File", menu=filemenu)
        filemenu.add_command(label="Load data",command = self.load_data)
        self.notifcation = Label(root,text="")
        self.notifcation.grid(row=0,column=0)

        root.mainloop()
コード例 #52
0
ファイル: filedialog.py プロジェクト: Exodus111/Projects
    def initUI(self):
        self.parent.title("File dialog")
        self.pack(fill=BOTH, expand=1)

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Open", command=self.onOpen)
        menubar.add_cascade(label="File", menu=fileMenu)

        self.txt = Text(self)
        self.txt.pack(fill=BOTH, expand=1)
コード例 #53
0
    def initUI(self):

        self.parent.title("MyStock")
        self.style = Style()
        self.style.theme_use("default")

        frame = Frame(self, relief=RAISED, borderwidth=1)
        frame.pack(fill=BOTH, expand=True)

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Exit", command=self.onExit)
        menubar.add_cascade(label="File", menu=fileMenu)

        submenu= Menu(fileMenu)
        submenu.add_command(label="New feed")
        submenu.add_command(label="Bookmarks")
        submenu.add_command(label="Mail")
        fileMenu.add_cascade(label='Import', menu=submenu, underline=0)

        fileMenu.add_separator()

        closeButton = Button(self, text="Close", command=self.quit)
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        okButton = Button(self, text="OK")
        okButton.pack(side=RIGHT)

        self.pack(fill=BOTH, expand=1)
        self.centerWindow()
コード例 #54
0
ファイル: menu.py プロジェクト: gilwoolee/bvhtool
    def __init__(self, parentwin):
        # This code based on rat book pp. 500-501
        topmenu = Menu(parentwin)  # Create the Menu object
        parentwin.config(menu=topmenu)  # Tell the window to use the Menu
        self.parentwin = parentwin

        filemenu = Menu(topmenu, tearoff=0)
        self.filemenu = filemenu
        retval = filemenu.add_command(label='Open... (ctrl-o)')
        retval = filemenu.add_command(label='Quit', command=parentwin.quit)
        topmenu.add_cascade(label='File', menu=filemenu)  # Don't forget this

        settingsmenu = Menu(topmenu, tearoff=0)
        self.settingsmenu = settingsmenu
        retval = settingsmenu.add_command(label='Grid off')
        retval = settingsmenu.add_command(label='Axes off')
        retval = settingsmenu.add_command(label='Camera readout off')
        topmenu.add_cascade(label='Settings', menu=settingsmenu)
        self.grid = 1  # On by default
        self.axes = 1
        self.readout = 1

        helpmenu = Menu(topmenu, tearoff=0)
        self.helpmenu = helpmenu
        helpmenu.add_command(label='About BVHPlay', command=self.about)
        helpmenu.add_command(label='Command list', command=self.commandlist)
        topmenu.add_cascade(label='Help', menu=helpmenu)
コード例 #55
0
 def _setup_menu(self):
     """
 Sets up a menu that lets the user save the proto board we are visualizing as
     a CMax file.
 """
     menu = Menu(self._parent, tearoff=0)
     save_menu = Menu(menu, tearoff=0)
     save_menu.add_command(label='Save as CMax file',
                           command=self._save_as_cmax_file)
     menu.add_cascade(label='File', menu=save_menu)
     edit_menu = Menu(menu, tearoff=0)
     edit_menu.add_command(label='Redraw wires', command=self._redraw_wires)
     menu.add_cascade(label='Edit', menu=edit_menu)
     self._parent.config(menu=menu)
コード例 #56
0
ファイル: widgets.py プロジェクト: hrchu/mtx-gui
 def onRightClick(self, event):
     if self.slot.status != 'Empty':
         popup = Menu(self,tearoff=0)
         unloadmenu = Menu(self, tearoff = 0)
         for slot in self.slot.device.storage_slots:
             if slot.status == 'Empty':
                 unloadmenu.add_command(label= u'storage slot %s' % slot.slot,
                     command=partial(self.menu_action, slot.slot))
         popup.add_cascade(label='unload',menu =unloadmenu)
         try:
             popup.tk_popup(event.x_root, event.y_root, 0)
         finally:
             popup.grab_release()
             self.updated()