def _make_filename_widgets(self):
        """Create and set 'method' and 'arguments' widgets."""
        method_lframe = ttk.LabelFrame(self.left_panel,
                                       text=_("Method"),
                                       padding=(5, 0, 5, 10))
        method_lframe.pack(fill="x", expand=True)

        filename_frm = ttk.Frame(method_lframe)
        filename_frm.pack(fill="x")
        filename_lbl = ttk.Label(filename_frm,
                                 text=_("Filename:"),
                                 foreground="grey")
        filename_lbl.pack(fill="x")
        self.filename_entry = ttk.Entry(filename_frm)
        self.filename_entry.insert(0, "[n]")
        self.filename_entry.pack(side="left", fill="x", expand=True)
        self.menu_btn = ttk.Menubutton(filename_frm, text="⚙️")
        self.menu_btn.pack(side="left")
        self.menu_btn.menu = Menu(self.menu_btn, tearoff=False)
        self.menu_btn["menu"] = self.menu_btn.menu

        arguments_frm = ttk.Frame(method_lframe)
        arguments_frm.pack(fill="x")
        arguments_lbl = ttk.Label(arguments_frm,
                                  text=_("Argument:"),
                                  foreground="grey")
        arguments_lbl.pack(fill="x")
        self.arguments_cbox = ttk.Combobox(arguments_frm,
                                           value=list(ARGUMENTS_DICT.values()),
                                           state='readonly')
        self.arguments_cbox.current(0)
        self.arguments_cbox.pack(fill="x")
Example #2
0
def create_macro_menu(parent, prog, pos_row, pos_col):
    #
    parent.b_macro = ttk.Menubutton(parent,
                                    text="Macros")  #, relief=tk.RAISED)

    parent.b_macro.menu = tk.Menu(parent.b_macro, tearoff=0)
    parent.b_macro['menu'] = parent.b_macro.menu
    parent.b_macro.menu.add_command(
        label="Run",
        command=lambda: macro_gui(parent, prog, "run"),
        activeforeground=COLORS.ok_active,
        foreground=COLORS.ok_front)
    parent.b_macro.menu.add_command(
        label="Learn",
        command=lambda: macro_gui(parent, prog, "learn"),
        activeforeground=COLORS.ok_active,
        foreground=COLORS.ok_front)
    parent.b_macro.menu.add_command(
        label="Finish Learn",
        command=lambda: macro_gui(parent, prog, "lend"),
        activeforeground=COLORS.ok_active,
        foreground=COLORS.ok_front)
    parent.b_macro.menu.entryconfig(1, state="normal")
    parent.b_macro.menu.entryconfig(2, state="disabled")
    parent.b_macro.grid(row=pos_row, column=pos_col, sticky='EWNS')
    parent.b_macro_ttp = CreateToolTip(parent.b_macro,\
    "Load and execute a macro at the current DISCUS_SUITE section. "
    "A macro is a prerecorded list of DISCUS_SUITE commands, that "
    "optionally may take parameters. "
    "You can also start to record a macro within this menu")
Example #3
0
 def create_widgets(self):
     menu_buttons = ttk.Menubutton(self, text='File')
     menu = tkinter.Menu(menu_buttons)
     menu_buttons['menu'] = menu
     menu.add_command(label="open", command=self.open_file)
     menu.add_command(label="quit", command=self.quit)
     menu_buttons.grid(row=0, column=0)
Example #4
0
    def __init__(self, master=None):
        # build ui
        frame_6 = ttk.Frame(master)

        button_9 = ttk.Button(frame_6)
        button_9.config(text='page2')
        button_9.configure(command=self.topage2)
        button_9.pack(side='top')
        label_2 = ttk.Label(frame_6)
        label_2.config(text='label_2')
        label_2.pack(side='top')
        label_3 = ttk.Label(frame_6)
        label_3.config(text='label_3')
        label_3.pack(side='top')
        label_4 = ttk.Label(frame_6)
        label_4.config(text='label_4')
        label_4.pack(side='top')
        radiobutton_2 = ttk.Radiobutton(frame_6)
        radiobutton_2.config(text='radiobutton_2')
        radiobutton_2.pack(side='top')
        menubutton_3 = ttk.Menubutton(frame_6)
        menubutton_3.config(text='menubutton_3')
        menubutton_3.pack(side='top')
        frame_6.config(height='200', width='200')
        frame_6.pack(side='top')

        # Main widget
        self.mainwindow = frame_6
        self.window = self.mainwindow
        self.master = master
Example #5
0
 def create_widgets(self):
     menub = ttk.Menubutton(self, text='select address')
     menu = Menu(menub)
     menub['menu'] = menu
     menu.add_command(label="Level1", command=self.level_one)
     menu.add_command(label="Level2", command=self.level_two)
     menub.pack()
Example #6
0
def help_menu(menu_frame):
    help_btn = ttk.Menubutton(menu_frame, text='Help', underline=0)
    help_btn.pack(side=tki.LEFT, padx='2m')
    help_btn.menu = tki.Menu(help_btn)
    help_btn.menu.add_command(label='How to', underline=0, command=how_to)
    help_btn['menu'] = help_btn.menu
    return help_btn
Example #7
0
    def set_notification_frame(*args):
        """
        Draw the notification frame, after game choosing
        :param args:
        :return:
        """
        notification.grid(column=0, row=5, columnspan=5, sticky=(N, W, E, S))
        line = sport.game_name
        if ':' in sport.game_time:
            line += ' is starting at ' + sport.game_time
        else:
            line += ' is currently at ' + sport.game_time

        mes_game_details.config(text=line)
        if sport.limits is not None:
            diff_spinbox = ttk.Spinbox(diff,
                                       from_=sport.limits[0],
                                       to=sport.limits[1],
                                       textvariable=diffVar)
            diff_spinbox.set(sport.limits[0])
            diff_spinbox.grid(row=0, column=0)
        if sport.time_list is not None:
            time_list = sport.get_time_list()
            timeToCheck.set(time_list[0])
            if sport.game_id is not '':
                time_mb = ttk.Menubutton(checking_time,
                                         textvariable=timeToCheck)
                time_mb.menu = Menu(time_mb, tearoff=0)
                time_mb['menu'] = time_mb.menu
                for t in time_list:
                    time_mb.menu.add_radiobutton(label=t, variable=timeToCheck)
                time_mb.grid()
Example #8
0
 def create_widgets(self):
     menub = ttk.Menubutton(self, text='help')
     menu = Menu(menub)
     menub['menu'] = menu
     menu.add_command(label="python ver", command=self.pythonVer)
     menu.add_command(label="about app", command=self.about)
     menub.pack()
    def __init__(self, parent, default_option, options, width,
                 *args, **kwargs):
        super().__init__(parent, *args, **kwargs)
        self.default_option = default_option
        self.options = options

        self.menubutton = ttk.Menubutton(self, text=default_option)
        menu = tk.Menu(self.menubutton, tearoff=False)
        self.menubutton.configure(menu=menu, width=width)
        self.menubutton.pack(padx=10, pady=10)

        self.choices = {}
        for choice in self.options:
            if not choice:
                choice = 'Выбрать все'
            self.choices[choice] = tk.IntVar(value=1 if choice == self.default_option
                                                   else 0)
            if choice == 'Выбрать все':
                menu.add_checkbutton(label=choice, variable=self.choices[choice],
                                     onvalue=1, offvalue=0,
                                     command=self._select_all_options)
            else:
                menu.add_checkbutton(label=choice, variable=self.choices[choice],
                                     onvalue=1, offvalue=0,
                                     command=self._select_single_option)
Example #10
0
    def __init__(self, root):
        tk.Frame.__init__(self, root)

        self.ribbon = tk.Frame(root)
        self.ribbon.place(relx=0.0, rely=0.0, relwidth=1, height=35)
        self.ribbon_top_separator = ttk.Separator(self.ribbon)
        self.ribbon_bottom_separator = ttk.Separator(self.ribbon)
        self.ribbon_top_separator.place(relx=0.0, rely=0.0, relwidth=1)
        self.ribbon_bottom_separator.place(relx=0.0, rely=0.9, relwidth=1)

        self.ribbon_vert_separator_1 = ttk.Separator(self.ribbon, orient='vertical')
        self.ribbon_vert_separator_1.place(x=35, relheight=0.9)
        self.ribbon_vert_separator_2 = ttk.Separator(self.ribbon, orient='vertical')
        self.ribbon_vert_separator_2.place(x=140, relheight=0.9)

        # Ribbon buttons
        self.refresh_icon = ImageTk.PhotoImage(Image.open('Icons/refresh-xxl.png').resize((25, 25)))
        self.add_new_folder_icon = ImageTk.PhotoImage(Image.open('Icons/folder.png').resize((25, 25)))
        self.external_link_icon = ImageTk.PhotoImage(Image.open('Icons/external-link-icon.png').resize((20, 20)))
        self.external_link_icon2 = ImageTk.PhotoImage(Image.open('Icons/refresh-xxl.png').resize((18, 20)))

        self.refresh_label = ttk.Label(self.ribbon)
        self.add_new_folder_label = ttk.Menubutton(self.ribbon)
        self.external_link_label = ttk.Menubutton(self.ribbon)
        self.external_link_label2 = ttk.Label(self.ribbon)

        self.refresh_label.config(image=self.refresh_icon)
        self.add_new_folder_label.config(image=self.add_new_folder_icon)
        self.external_link_label.config(image=self.external_link_icon)
        self.external_link_label2.config(image=self.external_link_icon2)

        self.refresh_label.place(x=2, y=2, width=30, height=30)
        self.add_new_folder_label.place(x=40, y=2, width=45, height=30)
        self.external_link_label.place(x=90, y=2, width=45, height=30)
        # self.external_link_label2.place(x=130, y=2, width=50, height=30)
        #
        # Search field
        self.search_anime = ttk.Entry(self.ribbon)
        self.search_anime.place(x=200, y=3.5, width=200, height=25)
        self.search_anime.insert(0, 'Filter list or search anime')

        self.search_button = ttk.Button(self.ribbon, text='Search', command=lambda: search_entry(self.search_anime))
        self.search_button.place(x=410, y=3.5, height=25)

        #
        def search_entry(entry):
            print(entry.get())
Example #11
0
 def create_preview_widget(self, parent, widget_id, xmlnode):
     self.builder = self._create_builder()
     self.builder.add_from_xmlnode(xmlnode)
     menubutton = ttk.Menubutton(parent, text='Menu preview')
     menubutton.grid()
     widget = self.builder.get_object(widget_id, menubutton)
     menubutton.configure(menu=widget)
     return menubutton
 def create_preview_widget(self, parent, widget_id, uidefinition):
     self.builder = self._create_builder()
     self.builder.uidefinition = uidefinition
     menubutton = ttk.Menubutton(parent, text='Menu preview')
     menubutton.grid()
     widget = self.builder.get_object(widget_id, menubutton)
     menubutton.configure(menu=widget)
     return menubutton
Example #13
0
    def _add_toolbar(self, parent):
        # add a toolbar (must be in a frame)
        toolbar = Frame(parent)

        if self.__tbDocked:
            # only create a tear off if the toolbar is being docked
            tearoff = Frame(toolbar,
                            cursor='fleur',
                            borderwidth=2,
                            relief=RAISED)

            # use a label as a 'grip' to tearoff toolbar
            # rather than the vertical scrollbars used in the
            # original Tcl demo
            self.__gripImg = BitmapImage(file='images\\gray25.xbm')
            grip = ttk.Label(tearoff, image=self.__gripImg)
            grip.pack(side=LEFT, fill=Y)
            tearoff.pack(side=LEFT)
            toolbar.__tearoff = tearoff

            # bind the 'tearoff grip' to capture dragging
            grip.bind('<ButtonPress-1>', self._start_tear)
            grip.bind('<ButtonRelease-1>', self._tear_off)

        # create the toolbar widgets
        contents = ttk.Frame(toolbar)

        btn = ttk.Button(
            contents,
            text='Button',
            style='Demo.Toolbutton',
            command=lambda: self.txt.insert(END, 'Button pressed.\n'))
        btn.pack(side=LEFT)

        cb = ttk.Checkbutton(contents, text='Check', style='Demo.Toolbutton')
        cb['command'] = lambda c=cb: self._say_check(c)
        cb.pack(side=LEFT)

        menu = Menu(contents)
        mb = ttk.Menubutton(contents, text='Menu', menu=menu)
        menu.add_command(label='Just',
                         command=lambda: self.txt.insert(END, 'Just\n'))
        menu.add_command(label='An',
                         command=lambda: self.txt.insert(END, 'An\n'))
        menu.add_command(label='Example',
                         command=lambda: self.txt.insert(END, 'Example\n'))
        mb.pack(side=LEFT)

        combo = ttk.Combobox(contents,
                             value=sorted(font.families()),
                             state='readonly')
        combo.bind('<<ComboboxSelected>>',
                   lambda e, v=combo: self._change_font(e, v.get()))
        combo.pack(side=LEFT)

        contents.pack(side=LEFT)

        return toolbar
Example #14
0
 def create_observe_button(self) -> None:
     image = self.app.get_icon(ImageEnum.OBSERVE, TOOLBAR_SIZE)
     menu_button = ttk.Menubutton(self.runtime_frame,
                                  image=image,
                                  direction=tk.RIGHT)
     menu_button.image = image
     menu_button.grid(sticky=tk.EW)
     self.observers_menu = ObserversMenu(menu_button, self.app)
     menu_button["menu"] = self.observers_menu
Example #15
0
 def _below_btn(self, parent):
     menu = Menu(parent, tearoff=False)
     mb = ttk.Menubutton(parent,
                         text='Below',
                         underline=0,
                         direction='below',
                         menu=menu)
     menu.add_command(label='Below menu: first item')
     menu.add_command(label="Below menu: second item")
     mb.grid(row=0, column=1, sticky=N)
Example #16
0
 def _above_btn(self, parent):
     menu = Menu(parent, tearoff=False)
     mb = ttk.Menubutton(parent,
                         text='Above',
                         underline=0,
                         direction='above',
                         menu=menu)
     menu.add_command(label='Above menu: first item')
     menu.add_command(label='Above menu: second item')
     mb.grid(row=2, column=1, sticky=S)
Example #17
0
 def __init__(self, master):
     super().__init__(master, text="Test ttk")
     ttk.Label(self, text="Label").pack()
     ttk.Button(self, text="Button").pack()
     ttk.Checkbutton(self, text="Checkbutton").pack()
     ttk.Entry(self, text='Entry').pack()
     ttk.Menubutton(self, text="Menubutton").pack()
     ttk.Radiobutton(self, text="Radiobutton").pack()
     ttk.Scale(self).pack()
     ttk.Scrollbar(self).pack()
Example #18
0
 def _left_btn(self, parent):
     menu = Menu(parent, tearoff=False)
     mb = ttk.Menubutton(parent,
                         text='Left',
                         underline=0,
                         direction='left',
                         menu=menu)
     menu.add_command(label='Left menu: first item')
     menu.add_command(label='Left menu: seconditem')
     mb.grid(row=1, column=2, sticky=E)
Example #19
0
    def __init__(self, master, *args, **kwargs):
        super(Widgets, self).__init__(master, *args, **kwargs)

        #--- entry ------------------------------------------------------------
        self.frame_entry = ttk.LabelFrame(self, text="Entry")
        self.frame_entry.pack(side="top", fill="x")

        entry = ttk.Entry(self.frame_entry)
        entry.grid(column=0, row=0)
        entry.insert(tkinter.END, "entry")

        tkinter.Spinbox(self.frame_entry,
                        values=[x for x in range(10)]).grid(column=1, row=0)
        ttk.Combobox(self.frame_entry,
                     values=[x * 100 for x in range(10)]).grid(column=2, row=0)

        tkinter.Text(self.frame_entry, height=10).grid(column=0,
                                                       row=1,
                                                       columnspan=3)

        self.frame_buttons = ttk.Frame(self)
        self.frame_buttons.pack(fill="x")

        frame_buttons_std = ttk.LabelFrame(self.frame_buttons, text="Buttons")
        # frame_buttons_std.grid(column=0, row=0)
        frame_buttons_std.pack(side="left")

        ttk.Button(frame_buttons_std, text="Button").pack()
        ttk.Button(frame_buttons_std, text="Image button").pack()
        ttk.Menubutton(frame_buttons_std, text="Menubutton").pack()

        frame_buttons_check = ttk.LabelFrame(self.frame_buttons,
                                             text="Check buttons")
        # frame_buttons_check.grid(column=1, row=0)
        frame_buttons_check.pack(side="left")

        ttk.Checkbutton(frame_buttons_check, text="Option 1").pack()
        ttk.Checkbutton(frame_buttons_check, text="Option 2").pack()
        ttk.Checkbutton(frame_buttons_check, text="Option 3").pack()

        frame_buttons_radio = ttk.LabelFrame(self.frame_buttons,
                                             text="Radio buttons")
        # frame_buttons_radio.grid(column=2, row=0)
        frame_buttons_radio.pack(side="left")

        ttk.Radiobutton(frame_buttons_radio, text="Option 1").pack()
        ttk.Radiobutton(frame_buttons_radio, text="Option 2").pack()
        ttk.Radiobutton(frame_buttons_radio, text="Option 3").pack()

        self.frame_progress = ttk.LabelFrame(self, text="Progress and scale")
        self.frame_progress.pack(fill="x")

        ttk.Progressbar(self.frame_progress).pack(fill="x")
        ttk.Scale(self.frame_progress).pack(fill="x")
Example #20
0
    def create_menu(self):
        self.top = self.winfo_toplevel()
        self.menu_bar = tk.Menu(self.top, tearoff=0)
        self.top["menu"] = self.menu_bar

        self.file_menu = tk.Menu(self.menu_bar, tearoff=0)
        self.menu_bar.add_cascade(label="File", menu=self.file_menu)
        file_menu_button = ttk.Menubutton(self.file_menu, takefocus=True)
        self.file_menu.add_command(label="Batch Process Words",
                                   command=self.batch_process_words)
        self.file_menu.add_command(label="Save Output",
                                   command=self.output_view.save)
        self.file_menu.add_command(label="Quit", command=self.quit)
Example #21
0
	def showMenubutton(self):
		options = {"text": "Menubutton"}
		self.selected_widget = ttk.Menubutton(self.widgetframe, **options)

		# self.selected_widget.menu = Menu(self.selected_widget, tearoff=0)
		menu = Menu(self.selected_widget, tearoff=0)
		self.selected_widget["menu"] = menu
		menu.add_cascade(label="option1")
		menu.add_cascade(label="option2")
		menu.add_separator()
		menu.add_checkbutton(label="checkbutton")
		menu.add_command(label="command")
		menu.add_radiobutton(label="radiobutton")
Example #22
0
    def create_widgets(self):
        menu_frame = ttk.Frame(master=self)
        menu_frame.pack(expand=False, fill=tk.X, side=tk.TOP)

        menu_button_label = ttk.Menubutton(master=menu_frame, text='Label')
        menu_label = tk.Menu(master=menu_button_label, tearoff=False)
        for text in range(1, 4):
            menu_label.add_command(
                label=f'Label {text}',
                command=None,
            )
        menu_button_label['menu'] = menu_label
        menu_button_label.pack(side=tk.LEFT)

        menu_button_chekbox = ttk.Menubutton(master=menu_frame,
                                             text='Checkbox')
        menu_chekbox = tk.Menu(master=menu_button_chekbox, tearoff=False)
        for text in range(1, 4):
            menu_chekbox.add_checkbutton(
                label=f'Checkbox {text}',
                command=None,
            )
        menu_button_chekbox['menu'] = menu_chekbox
        menu_button_chekbox.pack(side=tk.LEFT)

        menu_button_radiobutton = ttk.Menubutton(master=menu_frame,
                                                 text='Radiobutton')
        menu_radiobutton = tk.Menu(master=menu_button_radiobutton,
                                   tearoff=False)
        for text in range(1, 4):
            menu_radiobutton.add_radiobutton(
                label=f'Radiobutton {text}',
                command=None,
            )
        menu_button_radiobutton['menu'] = menu_radiobutton
        menu_button_radiobutton.pack(side=tk.LEFT)

        MyFrame(master=self)
Example #23
0
 def setTopMenu(self):
     #self.menubar = tk.Menu(self.root,tearoff=False)
     self.ttkMenubar = ttk.Menubutton(self.root)
     self.menubar = tk.Menu(self.root, tearoff=False)
     self.ttkMenubar['menu'] = self.menubar
     self.fileMenu = tk.Menu(self.menubar, tearoff=False)
     self.menubar.add_cascade(label=lblsTop.FILE,
                              underline=0,
                              menu=self.fileMenu)
     self.fileMenu.add_command(label=lblsTop.LOADEXAM,
                               underline=0,
                               compound=tk.LEFT,
                               command=self.loadExam)
     self.root.config(menu=self.menubar)
    def __init__(self):
        tk.Tk.__init__(self)
        self.title("VPN Manager")
        self.geometry("512x256")
        self.resizable(width=False, height=False)
        self.attributes('-alpha', 1)

        container = ttk.Frame(self)
        container.pack(side="top", fill="both", expand=True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)

        menu_bar = tk.Menu(self)
        self.config(menu=menu_bar)

        sub_menu = ttk.Menubutton(menu_bar)
        menu_bar.add_cascade(label="File", menu=sub_menu)

        self.installer = None  # which installer to use
        self.admin_rights = False  # if not run as admin prompt user to rerun as admin
        self.config = dict()  # loaded from config.p
        self.directory_servers = [
            '127.0.0.1'
        ]  # list of directory servers to pull configs from
        logging.basicConfig(level=logging.DEBUG)
        self.operating_system = platform.system()
        self.supported_os = {
            "Linux": self.linux_installer,
            "Windows": self.windows_installer
        }
        self.required_modules = []

        self.protocol("WM_DELETE_WINDOW", self.on_closing)

        self.frames = dict()
        for F in [HomeGUI, InstallScreen]:
            page_name = F.__name__
            frame = F(parent=container, controller=self)
            frame.grid(row=0, column=0, sticky=tk.NSEW)
            self.frames[page_name] = frame

        # config.p can be used to store user settings and preferences across reboots
        if os.path.isfile("config.p"):
            with open('config.p', 'rb') as config:
                self.config = pickle.load(config)
            self.show_frame('HomeGUI')
        else:
            self.show_frame('InstallScreen')

        self.mainloop()
    def __init__(self):
        super().__init__()
        self.menu2 = Menu(root, tearoff=False)
        self.menu2.add_cascade(label="Выгрузить в .txt",
                               command=self.save_txt_file)
        self.menu2.add_cascade(label="Выгрузить в .csv",
                               command=self.save_csv_file)
        self.menu2.add_cascade(label="Выгрузить в .xml",
                               command=self.save_xml_file)
        self.menu2.add_cascade(label="Выгрузить в .json",
                               command=self.save_json_file)

        self.image6 = ImageTk.PhotoImage(file="pictures/file_download.jpg")
        self.but6 = ttk.Menubutton(root, menu=self.menu2, image=self.image6)
        self.but6.place(x=552, y=0)
        self.count = 0
 def __init__(self):
     super().__init__()
     self.menu3 = Menu(root, tearoff=False)
     self.menu3.add_cascade(label="Добавить книгу в базу данных",
                            command=self.create_enter_window)
     self.menu3.add_cascade(label="Загрузить книги из .txt в бд",
                            command=self.load_txt_file)
     self.menu3.add_cascade(label="Загрузить книги из .csv в бд",
                            command=self.load_csv_file)
     self.menu3.add_cascade(label="Загрузить книги из .json в бд",
                            command=self.load_json_file)
     self.image3 = ImageTk.PhotoImage(file="pictures/add.jpg")
     self.but3 = ttk.Menubutton(root, menu=self.menu3, image=self.image3)
     self.but3.place(x=150, y=0)
     self.record = []
     self.enters_data = []
Example #27
0
    def _update_tkassignment(self, a: assignment.Assignemnt, row=None) -> None:
        """adds an assignment to the given course and updates the status bar"""
        if len(
                self._c.assignments
        ) - 1 < 1:  # -1 because the new assignment has already been added to the list
            self._init_assignments_info()
        if row is None:
            row = len(self._c.assignments)

        s = ttk.Style()
        s.configure('TMenubutton', font=utils.FONT)
        menu = ttk.Menubutton(self._assignments_frame,
                              text=a.name,
                              style='TMenubutton')
        dropdown = tk.Menu(menu, tearoff=False)
        dropdown.add_command(label='Edit Assignment',
                             command=lambda: self._edit_assingment(a))
        dropdown.add_command(label='Remove Assignment',
                             command=lambda: self._remove_assignment(a))
        menu['menu'] = dropdown
        menu.grid(row=row, column=0, sticky=tk.EW, padx=10)

        cat = utils.create_label(self._assignments_frame, a.category, row, 1)

        if a.points is None:
            points = utils.create_label(self._assignments_frame, 'N/A', row, 2)
        else:
            points = utils.create_label(self._assignments_frame, a.points, row,
                                        2)

        points_total = utils.create_label(self._assignments_frame,
                                          a.points_total, row, 3)

        self._assignments_widgets.update({
            a: {
                'name': menu,
                'cat': cat,
                'points': points,
                'points_total': points_total
            }
        })
        self._scroll.update_canvas()
Example #28
0
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.parent = parent
 
        # Options menu       
        mmenu = tk.Menu(self, tearoff=0)       
        mmenu.add_command(command=parent.logger, label="Begin logging")      
        mmenu.add_command(command=parent.setplot, label="Configure plot")
        
        mbtn = ttk.Menubutton(self, menu=mmenu, text="Menu", direction=RIGHT)        
        mbtn.pack(side=LEFT, padx=10, pady=4)

        # Text and scrollbar
        scrollbar = tk.Scrollbar(self)
        scrollbar.pack(side=RIGHT, fill=Y, pady=4)

        txtbox = tk.Text(self, height=2.1, yscrollcommand=scrollbar.set)
        txtbox.pack(fill=BOTH, expand=1, padx=4, pady=4)
        sys.stdout = RedirectTo(txtbox)
        scrollbar.config(command = txtbox.yview)   
Example #29
0
def create_loop_menu(parent, prog, pos_row, pos_col):
    #
    parent.b_loop = ttk.Menubutton(parent, text='Loops')  #, relief=tk.RAISED)

    parent.b_loop.menu = tk.Menu(parent.b_loop, tearoff=0)
    parent.b_loop['menu'] = parent.b_loop.menu
    parent.b_loop.menu.add_command(
        label='Do',
        command=lambda: loop_gui(parent, parent.b_loop.menu, prog, 'classic'),
        activeforeground=COLORS.ok_active,
        foreground=COLORS.ok_front,
        background=COLORS.bg_normal,
        activebackground=COLORS.bg_active)
    parent.b_loop.menu.add_command(
        label='Do While',
        command=lambda: loop_gui(parent, parent.b_loop.menu, prog, 'while'),
        activeforeground=COLORS.ok_active,
        foreground=COLORS.ok_front,
        background=COLORS.bg_normal,
        activebackground=COLORS.bg_active)
    parent.b_loop.menu.add_command(
        label='Do ... Until',
        command=lambda: loop_gui(parent, parent.b_loop.menu, prog, 'until'),
        activeforeground=COLORS.ok_active,
        foreground=COLORS.ok_front,
        background=COLORS.bg_normal,
        activebackground=COLORS.bg_active)
    parent.b_loop.menu.add_command(
        label='Finish Loop',
        command=lambda: loop_gui(parent, parent.b_loop.menu, prog, 'enddo'),
        activeforeground=COLORS.ok_active,
        foreground=COLORS.ok_front,
        background=COLORS.bg_normal,
        activebackground=COLORS.bg_active)
    parent.b_loop.menu.entryconfig(0, state='normal')
    parent.b_loop.menu.entryconfig(1, state='normal')
    parent.b_loop.menu.entryconfig(2, state='normal')
    parent.b_loop.menu.entryconfig(3, state='disabled')
    parent.b_loop.grid(row=pos_row, column=pos_col, sticky=tk.W)
    parent.b_loop_ttp = CreateToolTip(parent.b_loop,\
    'Allows to repeat a set of commands/instructions')
    def __init__(self):
        super().__init__()
        self.menu1 = Menu(root, tearoff=False)
        self.menu1.add_cascade(label="Создать новую базу данных",
                               command=self.create_new_file_db)
        self.menu1.add_cascade(label="Создать новую таблицу",
                               command=self.create_win_create_table)
        self.menu1.add_cascade(label="Удалить базу данных",
                               command=self.delete_file_db)

        self.image1 = ImageTk.PhotoImage(file="pictures/ph.jpg")
        self.but1 = ttk.Menubutton(root, menu=self.menu1, image=self.image1)
        self.but1.place(x=0, y=0)

        self.win_create_table = Text()
        self.enter_table_name = Entry()
        self.enter_column_values = Entry()
        self.column_data = ''
        self.my_table = ''
        self.new_data = []
        self.column_names = []
        self.data = []