Example #1
0
    def create_widgets(self, menubar):
        """
        Crea il layout del programma, finestra dell'Editor
        """
        # Menu
        self.filemenu = Menu(menubar, tearoff=0)
        self.filemenu.add_command(label='Apri', command=self.aprifile)
        self.filemenu.add_command(label='Salva', command=self.salvafile)
        self.filemenu.add_command(label='Cancella', command=self.cancella)
        self.filemenu.add_separator()
        self.filemenu.add_command(label='Esci', command=self.exit)
        menubar.add_cascade(label='Opzioni', menu=self.filemenu)
        self.master.config(menu=self.menubar)

        self.helpmenu = Menu(menubar, tearoff=0)
        self.helpmenu.add_command(label='Informazioni', command=self.infor)
        self.helpmenu.add_command(label='Legenda', command=self.leg)
        self.helpmenu.add_command(label='Guida', command=self.guida)
        menubar.add_cascade(label='Aiuto', menu=self.helpmenu)

        # Codice Assembly
        self.Inserisci = Text(self.codice, width=50, height=30, wrap=WORD)
        self.Inserisciscrollbar = Scrollbar(self.codice)
        self.Inserisciscrollbar.config(command=self.Inserisci.yview)
        self.Inserisci.config(yscrollcommand=self.Inserisciscrollbar.set)
        self.Inserisciscrollbar.grid(row=0, column=1, sticky=N + S)
        self.Inserisci.grid(row=0, column=0, sticky=W)
Example #2
0
    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='Set pitch')

        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='Pitch (mm) :', anchor=E)
        w.grid(row=0, column=0, sticky=NSEW)

        w = self.wPitch = XFloatEntry(wFrame,
                                      bg='white',
                                      width=10,
                                      borderwidth=2,
                                      justify=LEFT)
        w.grid(row=0, column=1, sticky=NSEW)
        w.enable_color(enable=False)
Example #3
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("./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()
Example #4
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-2>", self.showMenu)
        self.pack()
        
        
    def showMenu(self, e):
        self.menu.post(e.x_root, e.y_root)
       

    def onExit(self):
        self.quit()
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)
Example #6
0
 def __createWidgets(self):
     self.__params = Frame(padx=5, pady=5)
     Label(text='Letters: ', anchor=E).grid(row=0, column=0,
                                            sticky=E, in_=self.__params)
     self.__char_entry = Entry(width=10)
     self.__chk1st = Checkbutton(variable=self.MANDATORY1stCHAR, command=self.__CB)
     Label(text='First letter appears in every result ', anchor=W).grid(
         row=0, column=4, sticky=E, in_=self.__params)
     self.__char_entry.grid(row=0, column=1, columnspan=2,
                            sticky=W, in_=self.__params)
     self.__chk1st.grid(row=0, column=3, sticky=W, in_=self.__params)
     Label(text='Minimum length of result words: ', anchor=E).grid(
         row=1, column=0, sticky=E, in_=self.__params)
     self.__word_length_ctrl = Spinbox(from_=1, to=Application.MAXWORDLEN,
                                       width=2)
     self.__word_length_ctrl.delete(0, END)
     self.__word_length_ctrl.insert(0, Application. DEFAULTWORDLEN)
     self.__word_length_ctrl.grid(row=1, column=1, in_=self.__params,
                                  sticky=W)
     self.__go_button = Button(text='Go', command=self.__findWords)
     self.__go_button.grid(row=1, column=2, sticky=E, in_=self.__params)
     self.__Options = Menu()
     self.__Options.add_command(label='Choose dictionary',
                                        command=self.__choosedict)
     self.__File = Menu()
     self.__File.add_command(label='Export as ODT (Open document text)', command=self.__export)
     self.__char_entry.focus_set()
     self.__char_entry.bind("<Return>", self.__keyPressEnter)
Example #7
0
    def create_widgets(self, menubar):
        """
        Crea il layout del programma, finestra dell'Editor
        """
        # Menu
        self.filemenu = Menu(menubar, tearoff=0)
        self.filemenu.add_command(label='Apri', command=self.aprifile)
        self.filemenu.add_command(label='Salva', command=self.salvafile)
        self.filemenu.add_command(label='Cancella', command=self.cancella)
        self.filemenu.add_separator()
        self.filemenu.add_command(label='Esci', command=self.exit)
        menubar.add_cascade(label='Opzioni', menu=self.filemenu)
        self.master.config(menu=self.menubar)

        self.helpmenu = Menu(menubar, tearoff=0)
        self.helpmenu.add_command(label='Informazioni', command=self.infor)
        self.helpmenu.add_command(label='Legenda', command=self.leg)
        self.helpmenu.add_command(label='Guida', command=self.guida)
        menubar.add_cascade(label='Aiuto', menu=self.helpmenu)

        # Codice Assembly
        self.Inserisci = Text(self.codice, width=50, height=30, wrap=WORD)
        self.Inserisciscrollbar = Scrollbar(self.codice)
        self.Inserisciscrollbar.config(command=self.Inserisci.yview)
        self.Inserisci.config(yscrollcommand=self.Inserisciscrollbar.set)
        self.Inserisciscrollbar.grid(row=0, column=1, sticky=N + S)
        self.Inserisci.grid(row=0, column=0, sticky=W)
Example #8
0
    def __init__(self, parent, model_x, model_y, bg="white"):
        Tkinter.Frame.__init__(self)
        self.model_x = model_x
        self.model_y = model_y
        self.parent = parent
        #Barre Menu
        self.MenuBarre = Tkinter.Menu(self.master)

        #button_file
        self.button_file = Menu(self.MenuBarre, tearoff=0)
        self.MenuBarre.add_cascade(label="File",
                                   underline=0,
                                   menu=self.button_file)
        self.button_file.add_command(label="Open",
                                     underline=0,
                                     command=self.open)
        self.button_file.add_command(label="Save",
                                     underline=0,
                                     command=self.save)
        self.button_file.add_command(label="Exit",
                                     underline=0,
                                     command=self.exit)

        #button_Aide
        self.button_Aide = Menu(self.MenuBarre, tearoff=0)
        self.MenuBarre.add_cascade(label="Aide",
                                   underline=0,
                                   menu=self.button_Aide)
        self.button_Aide.add_command(label="Aide",
                                     underline=0,
                                     command=self.aide)

        self.master.config(menu=self.MenuBarre)
Example #9
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))
Example #10
0
    def __init__(self, rounds, filename, trail):
        self.root = Tk()

        self.menubar = Menu(self.root)
        self.filemenu = Menu(self.menubar, tearoff=0)
        self.filemenu.add_command(label="Save Trail", command=self.saveTrail)
        self.filemenu.add_command(label="Load Trail", command=self.loadTrail)
        self.filemenu.add_command(label="Export to Tex",
                                  command=self.exportToLatex)
        self.filemenu.add_command(label="Quit", command=self.root.quit)
        self.menubar.add_cascade(label="File", menu=self.filemenu)

        self.root.config(menu=self.menubar)
        self.trailUI = None
        if filename.endswith(".cfk"):
            self._loadTrailFromFile(open(filename, "rb"))
        elif filename.endswith(".trail"):
            self._initTrailUI(trail(rounds, filename=filename))
        elif filename.endswith(".json"):
            self._loadTrailFromJson(open(filename, "rb"))
        else:
            print "File extensions not supported. Use .trail, .cfk or .json"
            raise IOError()
        # self.mantis.printTrail()
        self.root.geometry("{:d}x{:d}".format(1920, 1080))
        self.root.mainloop()
Example #11
0
    def __init__(self, root, change_hook=None, highlighter=None, grammar=None):
        ScrolledText2.__init__(self, root, change_hook)
        # Non-wrapping, no border, undo turned on, max undo 50
        self.text = self  # For the methods taken from IDLE
        self.root = root
        self.change_hook = change_hook
        self.characters = ascii_letters + digits + punctuation
        self.tabwidth = 8  # for IDLE use, must remain 8 until Tk is fixed
        self.indentwidth = 4
        self.indention = 0  # The current indention level
        self.set_tabwidth(self.indentwidth)  # IDLE...
        self.previous_line = "0"

        # create a popup menu
        self.menu = Menu(root, tearoff=0)
        self.menu.add_command(label="Undo", command=self.edit_undo)
        self.menu.add_command(label="Redo", command=self.edit_redo)
        #self.menu.add_command(type="separator")
        self.menu.add_command(label="Cut", command=self.cut)
        self.menu.add_command(label="Copy", command=self.copy)
        self.menu.add_command(label="Paste", command=self.paste)

        self.bind('<KeyRelease>', self.key_release)  # For scanning input
        self.bind('<Return>', self.autoindent)  # Overides default binding
        #self.bind('<Tab>',self.autoindent) # increments self.indention
        #self.bind('<BackSpace>',self.autoindent) # decrements self.indention
        self.bind('<Button-3>', self.popup)  # right mouse button opens popup
        self.bind(
            '<Button-1>', self.recolorCurrentLine
        )  # left mouse can reposition cursor, so recolor (e.g. bracket highlighting necessary)
        self.bind('<Control-Any-KeyPress>', self.ctrl)

        self.grammar = grammar

        self.setHighlighter(highlighter)
Example #12
0
 def createwidgits(self):
     """Function Initializes some appearance features."""
     top = self.winfo_toplevel()
     # Resizable settings
     # Row Configurations
     top.rowconfigure(0, weight=0)
     top.rowconfigure(1, weight=0)
     top.rowconfigure(3, weight=0)
     top.rowconfigure(4, weight=1)
     # Column Configuration
     top.columnconfigure(0, weight=1)
     top.columnconfigure(2, weight=0)
     top.columnconfigure(3, weight=0)
     top.columnconfigure(4, weight=0)
     self.columnconfigure(0, weight=1, uniform=True)
     # Default alert bar settings
     self.variable.set('Search Ready!')
     # Menu Functionality
     # Functionality for importing script
     self.menubar = Menu(master=self, relief=tkinter.RAISED)
     self.filemenu = Menu(self.menubar, tearoff=0)
     # Menu Buttons
     self.menubar.add_command(label="Scan", command=self.onscan)
     self.menubar.add_separator()
     self.menubar.add_cascade(label="Options", menu=self.filemenu)
     self.filemenu.add_command(label="Scripts", command=self.script)
     self.filemenu.add_command(label="Info", command=self.info)
     # Adds previously loaded scripts to Tree
     self.reloadscripts()
Example #13
0
    def __init__(self, parent, scrollbar=True, **kw):

        parent = mx.get_master(parent)
        self.parent = parent

        frame = Frame(parent)
        frame.pack(fill='both', expand=True)

        # text widget
        if "wrap" not in kw:
            kw["wrap"] = "word"
        tk.Text.__init__(self, frame, **kw)
        #self.pack(side='left', fill='both', expand=True)
        mx.AllMixins.__init__(self, parent)

        # scrollbar
        if scrollbar:
            scrb = Scrollbar(frame, orient='vertical', command=self.yview)
            self.config(yscrollcommand=scrb.set)
            scrb.pack(side='right', fill='y')

        # pop-up menu
        self.popup = Menu(self, tearoff=0)
        self.popup.add_command(label='Cut', command=self._cut)
        self.popup.add_command(label='Copy', command=self._copy)
        self.popup.add_command(label='Paste', command=self._paste)
        self.popup.add_separator()
        self.popup.add_command(label='Select All', command=self._select_all)
        self.popup.add_command(label='Clear All', command=self._clear_all)
        self.bind('<Button-3>', self._show_popup)

        # only allow mouse scroll when mouse inside text
        self.bind("<Leave>", lambda event: self.winfo_toplevel().focus_set(),
                  "+")
        self.bind("<Enter>", lambda event: self.focus_set(), "+")
Example #14
0
 def addPrincipalOptions(self):
     identity = ["Principal"]
     def viewSchedule():
         identity.append("Schedule")
         identity.append(studentID.get())
         self.display(*identity)
     def viewSection():
         identity.append("Section")
         print(subject.get())
         identity.append(subject.get())
         self.display(*identity)
     schMb = Menubutton(self, text="View Schedules")
     schMb.menu = Menu(schMb)
     schMb["menu"] = schMb.menu
     studentID = IntVar()
     for n, student in studentSchedules.items():
         schMb.menu.add_radiobutton(label=student["name"], value=int(n),
                                 variable=studentID, command=viewSchedule)
     schMb.grid(row=1, column=0, padx=1, pady=1, sticky="nsew")
     secMb = Menubutton(self, text="View Course Sections")
     secMb.menu = Menu(secMb)
     secMb["menu"] = secMb.menu
     subject = StringVar()
     for course, sections in courseSections.items():
         secMb.menu.add_radiobutton(label=course, value=course,
                                 variable=subject, command=viewSection)
     secMb.grid(row=1, column=1, columnspan=2, padx=1, pady=1, sticky="nsew")
Example #15
0
 def displaySectionForPrincipal(self, subject):
     self.course = subject
     rows = 24
     columns = 3
     for row in range(rows):
         for column in range(columns):
             empty = Label(self)
             empty.grid(row=row, column=column, padx=1, pady=1, sticky="nsew")        
     label = Label(self, text=subject)
     label.grid(row=0, column=0, columnspan=3, padx=1, pady=1, sticky="nsew")
     self.sections = courseSections[subject].keys()
     self.noSection = IntVar()
     mb = Menubutton(self, text="Change Section")
     mb.menu = Menu(mb)
     mb["menu"] = mb.menu
     mb.menu.add_radiobutton(label=self.sections[0], value=0, 
                             variable=self.noSection, command=self.displaySection)
     mb.menu.add_radiobutton(label=self.sections[1], value=1, 
                             variable=self.noSection, command=self.displaySection)
     mb.grid(row=2, column=0, columnspan=2, padx=1, pady=1, sticky="nsew")
     def viewSection():
         self.displaySectionForPrincipal(subject.get())
     subject = StringVar()        
     subMb = Menubutton(self, text="Change Subject")
     subMb.menu=Menu(subMb)
     subMb["menu"] = subMb.menu
     for course, sections in courseSections.items():
         subMb.menu.add_radiobutton(label=course, value=course,
                                 variable=subject, command=viewSection)
     subMb.grid(row=2, column=2, padx=1, pady=1, sticky="nsew")
     self.displaySection()
Example #16
0
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
Example #17
0
	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
Example #18
0
    def __init__(self, master):
        self.root = master
        Menu.__init__(self, master.root, tearoff=0, postcommand=self.update)
        self.add_command(label="Undo",
                         command=self.root.undo,
                         accelerator="Ctrl+Z")
        self.add_command(label="Redo",
                         command=self.root.redo,
                         accelerator="Ctrl+Y")
        self.add_separator()
        self.add_command(label="Copy",
                         command=self.root.copy,
                         accelerator="Ctrl+C")
        self.add_command(label="Cut",
                         command=self.root.cut,
                         accelerator="Ctrl+X")
        self.add_command(label="Paste",
                         command=self.root.paste,
                         accelerator="Ctrl+V")
        self.add_separator()
        self.add_command(label="Select All",
                         command=self.root.select_all,
                         accelerator="Ctrl+A")

        self.bind("<FocusOut>", self.hide)  # hide when clicked off
Example #19
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)
Example #20
0
    def __init__(self, master):
        self.root = master  # console widget
        disable = lambda *e: None
        Menu.__init__(self, master.root, tearoff=0, postcommand=self.update)
        self.add_command(label="Undo",
                         command=disable,
                         accelerator="Ctrl+Z",
                         state=DISABLED)
        self.add_command(label="Redo",
                         command=disable,
                         accelerator="Ctrl+Y",
                         state=DISABLED)
        self.add_separator()
        self.add_command(label="Copy",
                         command=self.root.copy,
                         accelerator="Ctrl+C")
        self.add_command(label="Cut",
                         command=disable,
                         accelerator="Ctrl+X",
                         state=DISABLED)
        self.add_command(label="Paste",
                         command=disable,
                         accelerator="Ctrl+V",
                         state=DISABLED)
        self.add_separator()
        self.add_command(label="Select All",
                         command=self.root.select_all,
                         accelerator="Ctrl+A")

        self.bind("<FocusOut>", self.hide)  # hide when clicked off
Example #21
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()
 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
Example #23
0
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
Example #24
0
 def __init__(self, canvas, parent, item, menuList=[]):
     self.canvas = canvas
     self.parent = parent
     self.item = item
     self.state = 'collapsed'
     self.selected = 0
     self.children = {}
     self.kidKeys = []
     self.x = self.y = None
     self.iconimages = {}  # cache of PhotoImage instances for icons
     self.menuList = menuList
     self.menuVar = IntVar()
     self.menuVar.set(0)
     self._popupMenu = None
     self.image_id = None
     if self.menuList:
         if self.menuList[-1] == 'Separator':
             self.menuList = self.menuList[:-1]
         self._popupMenu = Menu(self.canvas, tearoff=0)
         for i in range(len(self.menuList)):
             item = self.menuList[i]
             if item == 'Separator':
                 self._popupMenu.add_separator()
             else:
                 self._popupMenu.add_radiobutton(
                     label=item,
                     variable=self.menuVar,
                     value=i,
                     indicatoron=0,
                     command=self.popupMenuCommand)
Example #25
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)
        #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()
 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
Example #27
0
    def label_dropdown(self, event):
        """When clicking right on a supervoxel, give a drop-down list
        with labels to change to."""

        if len(self.selected_id_list) == 0:
            return

        # Adding the selection menu with radio  buttons.
        self.menu = Menu(self, tearoff=0)
        self.menu\
            .add_radiobutton(label="Background",
                             value=0,
                             command=lambda arg0=0: \
                                        self.change_label(arg0))

        self.menu\
            .add_radiobutton(label=labels[0],
                             value=3,
                             command=lambda arg0=1: \
                                        self.change_label(arg0))

        self.menu\
            .add_radiobutton(label=labels[1],
                             value=2,
                             command=lambda arg0=2: \
                                        self.change_label(arg0))
        self.menu\
            .add_radiobutton(label=labels[2],
                             value=1,
                             command=lambda arg0=3: \
                                        self.change_label(arg0))
        self.menu.tk_popup(event.x_root, event.y_root)
    def __init__(self, name, add_handler, remove_handler, master=None):
        """
        Creates a ListFrame with the given name as its title.

        add_handler and remove_handler are functions to be called
        when items are added or removed, and should relay the information
        back to the Searcher (or whatever object actually uses the list).
        """
        LabelFrame.__init__(self, master)
        self['text'] = name
        self.add_handler = add_handler
        self.remove_handler = remove_handler
        self.list = Listbox(self)
        self.list.grid(row=0, columnspan=2)
        # Tkinter does not automatically close the right-click menu for us,
        # so we must close it when the user clicks away from the menu.
        self.list.bind("<Button-1>", lambda event: self.context_menu.unpost())
        self.list.bind("<Button-3>", self.open_menu)
        self.context_menu = Menu(self, tearoff=0)
        self.context_menu.add_command(label="Remove", command=self.remove)
        self.input = Entry(self)
        self.input.bind("<Return>", lambda event: self.add())
        self.input.grid(row=1, columnspan=2)
        self.add_button = Button(self)
        self.add_button['text'] = "Add"
        self.add_button['command'] = self.add
        self.add_button.grid(row=2, column=0, sticky=W + E)
        self.remove_button = Button(self)
        self.remove_button['text'] = "Remove"
        self.remove_button['command'] = self.remove
        self.remove_button.grid(row=2, column=1, sticky=W + E)
    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)
Example #30
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()
Example #31
0
    def __init__(self):
        Tk.__init__(self)
        self.title('socket tools in *nix')

        #Frame setting
        top_mbar = self.winfo_toplevel()

        frame_left = Frame(self)
        frame_right_top = Frame(self)
        frame_right_center = Frame(self)
        frame_right_bottom = Frame(self, height=40)

        #menu
        mbFile = Menu(top_mbar)
        top_mbar['menu'] = mbFile
        mbFile.subMenu = Menu(mbFile)
        mbFile.add_cascade(label='File', menu=mbFile.subMenu)
        mbFile.subMenu.add_command(label='Open', command=self.open_file)
        mbFile.subMenu.add_command(label='Exit', command=top_mbar.quit)
        mbFile.subMenu.entryconfig(0, state=Tkinter.DISABLED)

        #Button and Text
        self.text_send = Text(frame_right_center)
        self.text_send.grid()
        self.text_recv = Text(frame_right_top)
        self.text_recv.grid()

        #set ip and port
        ipf = Frame(frame_left, padx=10, pady=15)
        Label(ipf, text='ip', relief=Tkinter.RAISED, borderwidth=2, width=8).pack(side='left')
        self.ip = Entry(ipf)
        self.ip.pack(side='left')
        ipf.pack()

        portf = Frame(frame_left, padx=10, pady=5)
        Label(portf, text='port', relief=Tkinter.RAISED, borderwidth=2, width=8).pack(side='left')
        self.port = Entry(portf)
        self.port.pack(side='left')
        portf.pack()
        #set short and long link
        linkf = Frame(frame_left, padx=10, pady=15, relief=Tkinter.SUNKEN, borderwidth=2)
        self.flag = IntVar()
        Radiobutton(linkf, text="短链接", 
                value=0, variable=self.flag, 
                relief=Tkinter.RAISED)\
                        .pack(side=Tkinter.LEFT)
        Radiobutton(linkf, text="长链接", 
                value=1, variable=self.flag, 
                relief=Tkinter.RAISED)\
                        .pack(side=Tkinter.LEFT)
        linkf.pack()

        button_senddata = Button(frame_right_bottom, text='send', command=self.send).grid(sticky=Tkinter.W)

        #Grid
        frame_left.pack(side='left', anchor=Tkinter.N)
        frame_right_top.pack(side='top')
        frame_right_center.pack(side='top')
        frame_right_bottom.pack(side='top', anchor=Tkinter.E)
Example #32
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
Example #33
0
    def startUI(self):

        self.menu = Menu(self.parent, tearoff=0)
        self.menu.add_command(label="Beep", command=self.bell)
        self.menu.add_command(label="exit", command=self.quit)

        self.parent.bind("<Button-3>", self.showMenu)
        self.pack()
 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
Example #35
0
    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()
Example #36
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
Example #37
0
    def __init__(self, master):
        self.master = master
        self.master.title("Credo QSFP-SFP Tester")
        self.api = Falcon_lib()

        self.tab_1 = Frame(self.master,relief=)
        self.tab_1.grid(row=0,column=0)
        self.monitor_1 = Label(self.tab_1, text='RX Monitor 1')
        self.monitor_1.bind("<Button-3>", self.print_click)
        self.monitor_1.pack(ipady=5)
        self.table_1 = Frame(self.tab_1)
        self.table_1.pack(fill='both', padx=10)

        self.link_status = Label(self.table_1, text='Link Status')
        self.link_status.grid(row=1, sticky='W', padx=10)
        self.eye = Label(self.table_1, text='Eye Margin')
        self.eye.grid(row=3, sticky='W', padx=10)
        self.BER = Label(self.table_1, text='BER')
        self.BER.grid(row=4, sticky='W', padx=10)
        self.passfail = Label(self.table_1, text='Pass/Fail')
        self.passfail.grid(row=5, sticky='W', padx=10)



        self.table_2 = Frame(self.master)
        self.table_2.grid(row=0,column=1)#pack(fill='both', padx=10)
        self.monitor_2 = Label(self.tab_1, text='RX Monitor 2')
        self.monitor_2.pack(pady=10)

        self.link_status = Label(self.table_2, text='Link Status')
        self.link_status.grid(row=1, sticky='W', padx=10)
        self.eye = Label(self.table_2, text='Eye Margin')
        self.eye.grid(row=3, sticky='W', padx=10)
        self.BER = Label(self.table_2, text='BER')
        self.BER.grid(row=4, sticky='W', padx=10)
        self.passfail = Label(self.table_2, text='Pass/Fail')
        self.passfail.grid(row=5, sticky='W', padx=10)
        self.count = 0

        self.all_button = Button(self.tab_1, text='Reset All',
                                 command=self.prbs_reset)
        self.all_button.pack(pady=10)

        self.all_button1 = Button(self.tab_1, text='Reset All  1',
                                 command=self.testGPIO)
        self.all_button1.pack(pady=11)

        self.main_menu = Menu(self.master)
        self.master.config(menu=self.main_menu)
        self.option_menu = Menu(self.main_menu, tearoff=0)
        self.option_menu.add_command(label='Load Alternate Script',
                                     command=self.load_window)
        self.option_menu.add_separator()
        self.option_menu.add_command(label='Exit', command=the_end)
        self.main_menu.add_cascade(label='Options', menu=self.option_menu)

        self.table()
        self.display()
Example #38
0
 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)
Example #39
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
Example #40
0
    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)
Example #41
0
 def _add_menu(self, name):
     """Añade un menú a la barra de menus"""
     menu_aux = Menu(self._menu_bar)
     menu_aux.config(title=name)
     # FIXME: arreglar la inclusión de posicionamiento del menú
     # si queremos cambiar para que se pueda añadir un menu en la posicón
     # que queremos basta con poner un indice en los parametros de la
     # función y cambiar el indice por el len de la siguiente linea
     self._menus.insert(len(self._menus), menu_aux)
Example #42
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()
Example #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()
Example #44
0
 def _initMenu(self):
     self.menubar = Menu(self)
     self.config(menu=self.menubar)
     #Filemenu
     self.filemenu = Menu(self.menubar)
     self.filemenu.add_command(label="New", command=self.callback)
     self.filemenu.add_command(label="Open...", command=self.callback)
     self.filemenu.add_separator()
     self.filemenu.add_command(label="Exit", command=self.onExit)
     self.menubar.add_cascade(label="File", menu=self.filemenu)
Example #45
0
 def _initMenu(self):
     self.menubar = Menu(self)
     self.config(menu=self.menubar)
     #Filemenu
     self.filemenu = Menu(self.menubar)
     self.filemenu.add_command(label="New", command=self.callback)
     self.filemenu.add_command(label="Open...", command=self.callback)
     self.filemenu.add_separator()
     self.filemenu.add_command(label="Exit", command=self.onExit)
     self.menubar.add_cascade(label="File", menu=self.filemenu)
Example #46
0
        def __init__(self, connect_frame):
            self.connect_frame = Toplevel(root)

            # check watch version to use the correct instructional image
            if version == 'V1':
                connect_img = Image.open('data/connectV1.png')
                connect_img = ImageTk.PhotoImage(connect_img)

            else:
                connect_img = Image.open('data/connectV2.png')
                connect_img = ImageTk.PhotoImage(connect_img)

            img_label = Label(self.connect_frame, image=connect_img)
            # reference is needed to display image
            img_label.image = connect_img
            img_label.grid(row=0, column=0, padx=2, pady=2, sticky=W + E)

            Label(self.connect_frame, text="").grid(row=1, column=0, padx=2, pady=2, sticky=W + E)

            self.ok = Button(self.connect_frame, text='OK', command=self.connect_frame.destroy)
            self.ok.grid(row=2, column=0, padx=5, pady=5)

            # create the Menu base
            self.menu = Menu(root)
            # add the Menu
            self.connect_frame.config(menu=self.menu)

            # Create our Python menu
            self.menubar_opt = Menu(self.menu, tearoff=0)
            # Add our Menu to the Base Menu
            self.menu.add_cascade(label="Optionen", menu=self.menubar_opt)

            # Add items to the menu
            self.menubar_opt.add_command(label="Logout", command=self.dummy)
            self.menubar_opt.add_command(label="Benutzer", command=self.dummy)
            self.menubar_opt.add_separator()
            self.menubar_opt.add_command(label="Beenden", command=root.quit)

            # Create our Python menu
            self.menubar_hlp = Menu(self.menu, tearoff=0)
            # Add our Menu to the Base Menu
            self.menu.add_cascade(label="Hilfe", menu=self.menubar_hlp)

            # Add items to the menu
            self.menubar_hlp.add_command(label="Benutzung", command=self.dummy)
            self.menubar_hlp.add_command(label="sleeptracker.net", command=self.visit_slptrk)

            # Create our Python menu
            self.menubar_abt = Menu(self.menu, tearoff=0)
            # Add our Menu to the Base Menu
            self.menu.add_cascade(label="Über", menu=self.menubar_abt)

            # Add items to the menu
            self.menubar_abt.add_command(label="Version", command=self.dummy)
            self.menubar_abt.add_command(label="Projekt Homepage", command=self.visit_lnchpd)
Example #47
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
Example #48
0
 def __init__(self, master, **kwargs):
     self.root = master
     Menu.__init__(self, master.root, tearoff=0)
     self.add_command(label="Undo", state=DISABLED)
     self.add_command(label="Redo", state=DISABLED)
     self.add_separator()
     self.add_command(label="Copy", command=self.root.edit_copy)
     self.add_command(label="Cut", state=DISABLED)
     self.add_command(label="Paste", state=DISABLED)
     self.add_separator()
     self.add_command(label="Select All", command=self.root.select_all)
def main():
	root = tk.Tk(className="My First Python Editor")
	textPad = st.ScrolledText(root, width=100, height=30)
	textPad.pack()

	menu = Menu(root)
	root.config(menu=menu)
	fileMenu = Menu(menu)

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

	root.mainloop()	
Example #50
0
    def __init__(self, main_frame, menu_bar):
        self.menu = Menu(menu_bar, tearoff=0)

        self.menu.add_command(label='Open image',
                              command=main_frame.on_open_image)
        self.menu.add_command(label='Save classified image',
                              command=main_frame.on_save_classified_image)

        self.menu.add_separator()

        self.menu.add_command(label='Exit',
                              command=main_frame.on_exit_from_application)
Example #51
0
 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()
Example #52
0
    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)
Example #53
0
 def set_aide(self):
     """
     Create the "Fichier" menu and sub-menu
     """
     self.aide = Menu(self.menu, tearoff=0)
     self.aide.add_command(label=GT_("A propos"))
     self.menu.add_cascade(label=GT_("Aide"), menu=self.aide)
Example #54
0
    def __init__(self, parent, scrollbar=True, **kw):

        parent = mx.get_master(parent)
        self.parent = parent
        
        frame = Frame(parent)
        frame.pack(fill='both', expand=True)
        
        # text widget
        if "wrap" not in kw:
            kw["wrap"] = "word"
        tk.Text.__init__(self, frame, **kw)
        #self.pack(side='left', fill='both', expand=True)
        mx.AllMixins.__init__(self, parent)
        
        # scrollbar
        if scrollbar:
            scrb = Scrollbar(frame, orient='vertical', command=self.yview) 
            self.config(yscrollcommand=scrb.set)
            scrb.pack(side='right', fill='y')
        
        # pop-up menu
        self.popup = Menu(self, tearoff=0)
        self.popup.add_command(label='Cut', command=self._cut)
        self.popup.add_command(label='Copy', command=self._copy)
        self.popup.add_command(label='Paste', command=self._paste)
        self.popup.add_separator()
        self.popup.add_command(label='Select All', command=self._select_all)
        self.popup.add_command(label='Clear All', command=self._clear_all)
        self.bind('<Button-3>', self._show_popup)

        # only allow mouse scroll when mouse inside text
        self.bind("<Leave>", lambda event: self.winfo_toplevel().focus_set(), "+")
        self.bind("<Enter>", lambda event: self.focus_set(), "+")
Example #55
0
 def __init__(self, parent, scrollbar=True, **kw):
     
     self.parent = parent
     
     frame = Frame(parent)
     frame.pack(fill='both', expand=True)
     
     # text widget
     Text.__init__(self, frame, **kw)
     self.pack(side='left', fill='both', expand=True)
     
     # scrollbar
     if scrollbar:
         scrb = Scrollbar(frame, orient='vertical', command=self.yview) 
         self.config(yscrollcommand=scrb.set)
         scrb.pack(side='right', fill='y')
     
     # pop-up menu
     self.popup = Menu(self, tearoff=0)
     self.popup.add_command(label='Cut', command=self._cut)
     self.popup.add_command(label='Copy', command=self._copy)
     self.popup.add_command(label='Paste', command=self._paste)
     self.popup.add_separator()
     self.popup.add_command(label='Select All', command=self._select_all)
     self.popup.add_command(label='Clear All', command=self._clear_all)
     self.bind('<Button-3>', self._show_popup)
Example #56
0
 def create_mnu_edit():
     """
     Создаёт меню "Правка".
     """
     self.btn_edit = Menubutton(self.pnl_menu,
                                text=LANG_RU['mnu_edit'],
                                border=3,
                                relief='groove')
     self.mnu_edit = Menu(self.btn_edit)
     self.btn_edit.config(menu=self.mnu_edit)
     self.mnu_edit.add_command(label=LANG_RU['mnuEdit_Undo'],
                               accelerator='Ctrl+Z')
     self.mnu_edit.add_command(label=LANG_RU['mnuEdit_Redo'])
     self.mnu_edit.add_separator()
     self.mnu_edit.add_command(label=LANG_RU['mnuEdit_Copy'],
                               accelerator='Ctrl+C')
     self.mnu_edit.add_command(label=LANG_RU['mnuEdit_Cut'],
                               accelerator='Ctrl+X')
     self.mnu_edit.add_command(label=LANG_RU['mnuEdit_Paste'],
                               accelerator='Ctrl+V')
     self.mnu_edit.add_separator()
     self.mnu_edit.add_command(label=LANG_RU['mnuEdit_Find'],
                               accelerator='Ctrl+F')
     self.mnu_edit.add_command(label=LANG_RU['mnuEdit_Replace'],
                               accelerator='Ctrl+R')
     self.btn_edit.pack(side='left')
    def createNewSeparatorMenu(self):
        self.newSeparatorMenu = Menu(self.optionsMenu, tearoff=0)
        
        self.spacesButton      = BooleanVar()
        self.underscoresButton = BooleanVar()
        self.camelcaseButton  = BooleanVar()
        self.periodButton     = BooleanVar()
        
        self.newSeparatorMenu.add_checkbutton(label="Spaces", onvalue=True, offvalue=False, 
                                              variable=self.spacesButton, command=self.ToggleNonSpacesOff)
        
        self.spacesButton.set(True)
        
        self.newSeparatorMenu.add_checkbutton(label="Underscores", onvalue=True, offvalue=False, 
                                              variable=self.underscoresButton, command=self.ToggleNonUnderscoresOff)
        
            
        self.newSeparatorMenu.add_command(label="Custom Separator", command=self.customSeparatorFrame)

        self.newSeparatorMenu.add_checkbutton(label="CamelCase", onvalue=True, offvalue=False, 
                                              variable=self.camelcaseButton, command=self.ToggleNonCamelCaseOff)
        self.newSeparatorMenu.add_checkbutton(label="Period", onvalue=True, offvalue=False, 
                                              variable=self.periodButton, command=self.ToggleNonPeriodOff)
        
        self.optionsMenu.add_cascade(label="New Separator", menu=self.newSeparatorMenu)
 def createAppendTextMenu(self):
     self.appendText             = Menu(self.optionsMenu, tearoff=0)
     
     self.appendText.add_command(label="Append To Front", command=self.appendToFrontFrame)
     self.appendText.add_command(label="Append To End", command=self.appendToEndFrame)
     
     self.optionsMenu.add_cascade(label="Append Text", menu=self.appendText)
    def CreateOldSeparatorMenu(self):
        self.oldSeparatorMenu = Menu(self.optionsMenu, tearoff=0)
        
        self.oldSpacesButton      = BooleanVar()
        self.oldUnderscoresButton = BooleanVar()
        self.oldCamelcaseButton  = BooleanVar()
        self.oldPeriodButton     = BooleanVar()
        
        self.oldSeparatorMenu.add_checkbutton(label="Spaces", onvalue=True, offvalue=False, 
                                              variable=self.oldSpacesButton)
        
        self.oldSpacesButton.set(True)
        
        self.oldSeparatorMenu.add_checkbutton(label="Underscores", onvalue=True, offvalue=False, 
                                              variable=self.oldUnderscoresButton)
        
        self.oldUnderscoresButton.set(True)
            
        #self.oldSeparatorMenu.add_command(label="Custom Separator", command=self.customSeparatorFrame)

        self.oldSeparatorMenu.add_checkbutton(label="CamelCase", onvalue=True, offvalue=False, 
                                              variable=self.oldCamelcaseButton)
                
        self.oldSeparatorMenu.add_checkbutton(label="Period", onvalue=True, offvalue=False, 
                                              variable=self.oldPeriodButton)
        
        self.optionsMenu.add_cascade(label="Old Separator", menu=self.oldSeparatorMenu)
Example #60
0
 def _init(self):
   """
   Creates the board and palette.
   """
   self._file_name = None
   self._root = Tk()
   self._root.resizable(0, 0)
   self._menu = Menu(self._root, tearoff=0)
   self.board = Board(self._root, self._menu, width=self._board_width,
       height=self._board_height, directed_wires=self._directed_wires,
       label_tooltips_enabled=self._label_tooltips_enabled,
       same_label_per_connector=self._same_label_per_connector,
       on_changed=self._on_changed, on_exit=self._request_save)
   self._init_board()
   self.palette = Palette(self._root, self.board, width=self._board_width,
       height=self._palette_height)
   # buttons to change board cursor state
   self.palette.current_left_x -= PALETTE_PADDING
   self._draw_display = self.palette.add_drawable_type(Image_Run_Drawable,
       LEFT, self._switch_cursor_to_draw, image_file=PENCIL_IMAGE)
   self.palette.current_left_x -= PALETTE_PADDING
   self._drag_display = self.palette.add_drawable_type(Image_Run_Drawable,
       LEFT, self._switch_cursor_to_drag, image_file=HAND_IMAGE)
   self.palette.draw_separator()
   self._switch_cursor_to_draw()