예제 #1
0
    def __init__(self):
        self.VAR_ENTRY_MESSAGE_DURATION = StringVar()
        self.VAR_ENTRY_MESSAGE_INTERMISSION = StringVar()
        self.VAR_LABEL_MESSAGE_COLOR_TEXT = StringVar()
        self.VAR_LABEL_MESSAGE_COLOR_FOREGROUND = ""
        self.VAR_FONT_COMBO_BOX = StringVar()
        self.VAR_ENTRY_NORMAL_FONT_SIZE = StringVar()
        self.VAR_ARRIVAL = StringVar()
        self.VAR_DEPARTURE = StringVar()
        self.VAR_FONT_IS_BOLD = BooleanVar()
        self.VAR_FONT_IS_ITALIC = BooleanVar()
        self.VAR_FONT_IS_OVERSTRIKE = BooleanVar()
        self.VAR_ALIGNMENT = StringVar()

        self.VAR_WINDOW_WIDTH = StringVar()
        self.VAR_WINDOW_HEIGHT = StringVar()
        self.VAR_LABEL_WINDOW_BG_COLOR_BACKGROUND = ""
        self.VAR_LABEL_WINDOW_BG_COLOR_TEXT = StringVar()
        self.VAR_DISPLAY_WINDOW_BG_IMAGE = StringVar()
        self.VAR_PATH_WINDOW_BG_IMAGE = StringVar()
        self.VAR_ENTRY_MOVE_ALL_ON_LINE_DELAY = StringVar()
        self.VAR_MESSAGE_SHUFFLE = BooleanVar()
        self.getDefaultValues()
예제 #2
0
    def __init__(self,
                 title="",
                 message="",
                 button="Ok",
                 image=None,
                 checkmessage="",
                 **options):
        """
            Create a messagebox with one button and a checkbox below the button:
                parent: parent of the toplevel window
                title: message box title
                message: message box text
                button: message displayed on the button
                image: image displayed at the left of the message
                checkmessage: message displayed next to the checkbox
                **options: other options to pass to the Toplevel.__init__ method
        """
        Tk.__init__(self, **options)
        self.title(title)
        self.resizable(False, False)
        self.columnconfigure(1, weight=1)
        self.rowconfigure(0, weight=1)

        style = Style(self)
        style.theme_use(STYLE)
        self.img = None
        if isinstance(image, str):
            try:
                self.img = PhotoImage(file=image)
            except TclError:
                self.img = PhotoImage(data=image)
        elif image:
            self.img = image
        if self.img:
            Label(self, image=self.img).grid(row=0,
                                             column=0,
                                             padx=10,
                                             pady=(10, 0))
        Label(self, text=message, wraplength=335,
              font="TkDefaultFont 10 bold").grid(row=0,
                                                 column=1,
                                                 padx=10,
                                                 pady=(10, 0))
        b = Button(self, text=button, command=self.destroy)
        b.grid(row=2, padx=10, pady=10, columnspan=2)
        self.var = BooleanVar(self)
        c = Checkbutton(self, text=checkmessage, variable=self.var)
        c.grid(row=1, padx=10, pady=4, sticky="e", columnspan=2)
        self.grab_set()
        b.focus_set()
예제 #3
0
 def test_set(self):
     true = 1 if self.root.wantobjects() else '1'
     false = 0 if self.root.wantobjects() else '0'
     v = BooleanVar(self.root, name='name')
     v.set(True)
     self.assertEqual(self.root.globalgetvar('name'), true)
     v.set('0')
     self.assertEqual(self.root.globalgetvar('name'), false)
     v.set(42)
     self.assertEqual(self.root.globalgetvar('name'), true)
     v.set(0)
     self.assertEqual(self.root.globalgetvar('name'), false)
     v.set('on')
     self.assertEqual(self.root.globalgetvar('name'), true)
예제 #4
0
 def test_set(self):
     true = 1 if self.root.wantobjects() else "1"
     false = 0 if self.root.wantobjects() else "0"
     v = BooleanVar(self.root, name="name")
     v.set(True)
     self.assertEqual(self.root.globalgetvar("name"), true)
     v.set("0")
     self.assertEqual(self.root.globalgetvar("name"), false)
     v.set(42)
     self.assertEqual(self.root.globalgetvar("name"), true)
     v.set(0)
     self.assertEqual(self.root.globalgetvar("name"), false)
     v.set("on")
     self.assertEqual(self.root.globalgetvar("name"), true)
예제 #5
0
 def __init__(self, *args, **kwargs):
     dprint(3, "\nBook::__init__")
     if "ruling" in kwargs:
         self._ctrl = kwargs["ruling"]
         del kwargs["ruling"]
     self._pgs = []
     NotebookCloseTab.__init__(self, *args, **kwargs)
     self.__search_case = BooleanVar()
     self.__search_phrase = StringVar()
     self.__search_subst = StringVar()
     self.bind("<<NotebookTabChanged>>", lambda e: self.__switched_tabs())
     if self._ctrl:
         self.__blanktext(None)
         self.__ready(self._pgs[0])
예제 #6
0
    def add_setting_field(self, field):
        master = self.frames[field['category']]
        optionFrame = Frame(master)
        key = field['name']

        if field['type'] == 'checkbox':
            self.selections[key] = BooleanVar(optionFrame)
            checkboxField = ttk.Checkbutton(optionFrame,
                                            text=field['label'],
                                            variable=self.selections[key])
            if 'help' in field:
                CreateToolTip(checkboxField, field['help'])

            checkboxField.pack(side=LEFT)
        elif field['type'] == 'select':
            optionLabel = ttk.Label(optionFrame, text=field['label'])
            optionLabel.pack(side=LEFT)
            if 'help' in field:
                CreateToolTip(optionLabel, field['help'])

            self.selections[key] = StringVar(optionFrame)
            self.combobox_selections[key] = StringVar(optionFrame)

            choice_dict = {
                option['label']: option['value']
                for option in field['options']
            }
            choice_dict_invert = {
                option['value']: option['label']
                for option in field['options']
            }
            self.selections[key].set(field['options'][0]['value'])

            optionsField = ttk.OptionMenu(
                optionFrame,
                self.combobox_selections[key],
                field['options'][0]['label'],
                *[option['label'] for option in field['options']],
                command=lambda *args, sel_key=key, choices=choice_dict: self.
                selections[sel_key].set(choices[self.combobox_selections[
                    sel_key].get()]))
            self.selections[key].trace(
                'w',
                lambda *args, sel_key=key, choices=choice_dict_invert: self.
                combobox_selections[sel_key].set(choice_dict_invert[
                    self.selections[sel_key].get()]))

            optionsField.pack(side=LEFT, fill=X, expand=True)

        optionFrame.pack(side=TOP, padx=5, pady=(5, 1), fill=X)
예제 #7
0
def viewFactsGrid(modelXbrl, tabWin, header="Fact Grid", arcrole=XbrlConst.parentChild, linkrole=None, linkqname=None, arcqname=None, lang=None):
    modelXbrl.modelManager.showStatus(_("viewing facts"))
    view = ViewFactsGrid(modelXbrl, tabWin, header, arcrole, linkrole, linkqname, arcqname, lang)
    if view.tableSetup():
    
        view.ignoreDims = BooleanVar(value=False)
        view.showDimDefaults = BooleanVar(value=False)

        # context menu
        menu = view.contextMenu()
        optionsMenu = Menu(view.viewFrame, tearoff=0)
        view.ignoreDims.trace("w", view.view)
        optionsMenu.add_checkbutton(label=_("Ignore Dimensions"), underline=0, variable=view.ignoreDims, onvalue=True, offvalue=False)
        view.showDimDefaults.trace("w", view.view)
        optionsMenu.add_checkbutton(label=_("Show Dimension Defaults"), underline=0, variable=view.showDimDefaults, onvalue=True, offvalue=False)
        menu.add_cascade(label=_("Options"), menu=optionsMenu, underline=0)
        menu.add_cascade(label=_("Close"), underline=0, command=view.close)
        view.menuAddLangs()
        view.view()
        view.blockSelectEvent = 1
        view.blockViewModelObject = 0
        view.viewFrame.bind("<Enter>", view.cellEnter, '+')
        view.viewFrame.bind("<Leave>", view.cellLeave, '+')
예제 #8
0
 def __init__(self):
     super().__init__()
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.sock.connect(communication.SERVER_ADDRESS)
     self.sock.setblocking(False)
     self.title('OnlineDrive - Welcome')
     # Informa à aplicação qual método chamar ao fechar.
     self.protocol('WM_DELETE_WINDOW', self.on_close)
     self.current_frame = Frame()
     self.user_logged = BooleanVar()
     self.user_logged.set(False)
     self.user_logged.trace('w', self.user_state_changed)
     # Inicia o thread que recebe dados do servidor.
     Thread(target=self.get_server_response).start()
예제 #9
0
    def __init__(self, window, text=' ', instance=str):

        if instance == str:
            self.variable = StringVar(window.root, value=text)
        elif instance == float:
            self.variable = DoubleVar(window.root, value=text)
        elif instance == int:
            self.variable = IntVar(window.root, value=text)
        elif instance == bool:
            self.variable = BooleanVar(window.root, value=text)

        widget = Label(window.main_frame, textvar=self.variable)

        HOPSWidget.__init__(self, window, widget, 'Label')
예제 #10
0
    def createPage(self):
        Label(self, text='分类算法').grid(row=0, column=0)
        #设置窗口背景
        style = ttk.Style()
        style.configure("BW.TLabel", font=("微软雅黑", "12"))  #默认字体

        self.learn_pathdb = StringVar()
        Entry(self, textvariable=self.learn_pathdb, width=50).grid(row=1,
                                                                   column=0)
        Button(self, text='导入学习文件',
               command=self.selectLearningPath).grid(row=1, column=1)

        self.predict_pathdb = StringVar()
        Entry(self, textvariable=self.predict_pathdb, width=50).grid(row=2,
                                                                     column=0)
        Button(self, text='导入预测文件',
               command=self.selectPreDictPath).grid(row=2, column=1)

        Button(self, text='运行', width=10, command=self.run).grid(row=3,
                                                                 column=1)

        algo_frame = Frame(self)
        algo_frame.grid(row=3)

        self.algorithm1 = BooleanVar()
        Checkbutton1 = Checkbutton(algo_frame,
                                   text="支持向量机",
                                   variable=self.algorithm1,
                                   command=self.func)
        Checkbutton1.grid(row=0, column=0, sticky='W')

        self.algorithm2 = BooleanVar()
        Checkbutton2 = Checkbutton(algo_frame,
                                   text="随机森林",
                                   variable=self.algorithm2,
                                   command=self.func)
        Checkbutton2.grid(row=0, column=1, sticky='W')
예제 #11
0
    def init_ui(self):
        """Skapa gränssnittet och kör igång mainloop."""
        self.root = Tk()
        self.root.title("Laboration 5")
        # root.resizable(width=False, height=False)

        # Tk-variabler till kvadratsstorlek, antal kvadrater, start_left och
        # start_top.
        self.size_value = StringVar()
        self.size_value.set(self.size_options[0])
        self.number_of_squares = IntVar()
        self.start_left = BooleanVar()
        self.start_left.set(True)
        self.start_top = BooleanVar()
        self.start_top.set(True)

        # Frame att lägga kvadraterna i
        self.square_frame = Frame(self.root,
                                  #height=self.squares_frame_height,
                                  #width=self.squares_frame_width,
                                  bg="#eef")
        if self.debug:
            self.square_frame.bind("<Configure>", self.frame_changed)
        self.square_frame.pack(side=TOP, expand=1, fill=BOTH,
                               padx=self.ui_xpadding, pady=self.ui_ypadding)

        # Frame med inställningar
        self.controll_panel = LabelFrame(self.root, text="Inställningar")
        self.init_controll_panel()
        self.controll_panel.pack(fill=BOTH,
                                 padx=self.ui_xpadding, pady=self.ui_ypadding)

        # Informationstext
        infotext = "Kom ihåg att ändra fönstrets storlek när du testar! " + \
                   "Se även utskrifterna i terminalen."
        self.instructions = Label(self.root, text=infotext)
        self.instructions.pack(anchor=W)
예제 #12
0
    def gui_main(self):
        # Root Window Init
        self.window = ThemedTk(theme="radiance")
        self.window.geometry("435x340")
        self.window.title("Restaurant Management System")
        self.window.configure(background="#F6F4F2")
        self.window.resizable(0, 0)

        self.view_var = BooleanVar()

        # Heading
        ttk.Label(self.window,
                  font=("default", 19, "bold"),
                  text="Kitchen Manager").grid(row=0,
                                               column=0,
                                               sticky="w",
                                               padx=15)
        ttk.Separator(self.window, orient="horizontal").grid(row=1,
                                                             columnspan=2,
                                                             sticky="ew")

        # Tree View
        self.listbox = ttk.Treeview(self.window)
        self.listbox["columns"] = ("Details")
        self.listbox.heading("#0", text="Order No")
        self.listbox.heading("#1", text="Details")
        self.listbox.column("#0", minwidth=0, width=100)
        self.listbox.column("#1", minwidth=0, width=300)
        self.listbox.bind('<Double-1>', self.selectItem)
        ttk.Style().configure("Treeview",
                              fieldbackground="#FEFEFE",
                              background="#FEFEFE")

        self.main_refresh(self.view_bool)
        self.listbox.grid(row=2, column=0, sticky="nse", padx=15, pady=10)

        self.view_all = ttk.Checkbutton(self.window,
                                        text="View all orders",
                                        variable=self.view_var,
                                        command=self.cb).grid(row=3,
                                                              column=0,
                                                              sticky="w",
                                                              padx=15)
        ttk.Button(self.window, text="Quit",
                   command=self.window.destroy).grid(row=3,
                                                     column=0,
                                                     sticky="e",
                                                     padx=15)
        self.window.mainloop()
예제 #13
0
def popup_settings() -> None:
    """Открывает окно 'Настройки'."""
    popup = Toplevel()
    log_var = BooleanVar()
    launchicon = PhotoImage(file = 'data/imgs/20ok.png')
    center_x_pos = int(popup.winfo_screenwidth() / 2) - POPUP_WIDTH
    center_y_pos = int(popup.winfo_screenheight() / 2) - POPUP_HEIGHT

    popup.geometry(f'{POPUP_WIDTH}x{POPUP_HEIGHT}+'
                   f'{center_x_pos}+{center_y_pos}')
    popup.title(_('Settings'))
    popup.resizable(False, False)
    frame_settings = LabelFrame(popup, text = _('Settings'))
    frame_settings.grid(sticky = 'NWSE', column = 0, row = 0,
                        ipadx = 5, padx = 5, pady = 5)

    lang_label = Label(frame_settings, text = _('Localisation'))
    lang_label.grid(column = 0, row = 0, ipadx = 5)

    logs_label = Label(frame_settings, text = _('Logging'))
    logs_label.grid(column = 0, row = 1, ipadx = 5)

    lang_vars = Combobox(frame_settings, state = 'readonly',
                         values = check_langs(), width = 4)
    lang_vars.current(current_lang())
    lang_vars.grid(column = 1, row = 0)
    log_settings = Checkbutton(frame_settings,
                               variable = log_var, onvalue = True,
                               offvalue = False)

    log_settings.grid(column = 1, row = 1)

    if getconfig()['settings']['logging'] == 'True':
        log_var.set(True)
    elif getconfig()['settings']['logging'] == 'False':
        log_var.set(False)

    apply_button = Button(popup, text = _('Apply'), width = 20,
                          compound = 'left', image = launchicon,
                          command = lambda: apply(
                                                  lang_vars.get(),
                                                  popup, log_var.get()
                                                  )
                          )
    apply_button.grid(column = 0, row = 1)

    popup.grab_set()
    popup.focus_set()
    popup.wait_window()
예제 #14
0
    def construir_seleccion_banda(self):

        self.frame_titulo_bandas = Label(self.frame_medicion)
        self.frame_titulo_bandas.config(borderwidth=2, relief="groove")
        self.frame_titulo_bandas.grid(row=0,
                                      column=0,
                                      sticky="nsew",
                                      padx=10,
                                      pady=(15, 0))
        self.label_titulo_bandas_octava = Label(self.frame_titulo_bandas)
        self.label_titulo_bandas_octava.config(text=self.titulo_bandas_text,
                                               bg="#0c005a")
        self.label_titulo_bandas_octava.pack(ipadx=10,
                                             expand="True",
                                             fill="both")
        self.frame_medicion_bandas = Frame(self.frame_medicion)
        self.frame_medicion_bandas.grid(row=1,
                                        column=0,
                                        sticky="nsew",
                                        padx=10,
                                        pady=(20, 0))
        bandas_estandar = self.obtener_bandas()
        self.banda_seleccionada = StringVar()
        self.banda_seleccionada.set(bandas_estandar[0])
        self.combobox_banda = OptionMenu(self.frame_medicion_bandas,
                                         self.banda_seleccionada,
                                         *bandas_estandar)
        self.combobox_banda.config(relief="groove",
                                   borderwidth=0,
                                   bg="#5893d4",
                                   activebackground="#0060ca",
                                   width=20)
        self.combobox_banda['menu'].config(bg="#5893d4",
                                           activebackground="#0060ca")
        self.combobox_banda.grid(row=0, column=0, padx=10)
        self.ponderacion_A_checked = BooleanVar(False)
        self.checkbutton_ponderacion_A = Checkbutton(
            self.frame_medicion_bandas)
        self.checkbutton_ponderacion_A.config(
            text="Ponderación A",
            variable=self.ponderacion_A_checked,
            selectcolor="#5e0606")
        self.checkbutton_ponderacion_A.grid(row=0, column=1, padx=20)
        self.boton_calcular = Button(self.frame_medicion_bandas)
        self.boton_calcular.config(text="Calcular",
                                   command=self.view.on_calcular,
                                   bg="#5e0606",
                                   width=20)
        self.boton_calcular.grid(row=0, column=2, padx=10)
예제 #15
0
    def __init__(self, parent):

        Frame.__init__(self, parent)
        self.parent = parent
        self.test01 = BooleanVar()
        checkbutton = Checkbutton(parent,
                                  text='check it',
                                  variable=self.test01,
                                  command=self.testcheck)

        checkbutton.pack()

        testbutton = Button(parent, text='check test', command=self.testcheck)
        testbutton.pack()
        self.parent.title('Checkbutton test')
예제 #16
0
    def __init__(self, text, cfg, key):
        self.checkbox = None
        self.enabled = True

        self.value = BooleanVar()
        self.text = text
        self.cfg = cfg
        self.key = key
        try:
            if self.cfg[self.key] not in (True, False):
                self.value.set(False)
            else:
                self.value.set(self.cfg[self.key])
        except KeyError:
            self.value.set(False)  # default to False
예제 #17
0
def pricesWindow(previousWindow):
        # closes menu and opens prices window
        pricesSelection = Tk()
        previousWindow.withdraw()
        pricesSelection.configure(bg='light cyan')
        pricesSelection.title('Prices of Items')
        pricesSelection.geometry('400x310')
        label = Label(pricesSelection, text = 'Select item(s):',
              bd = 0,
              relief = 'solid',
              width = 15,
              height = 2,
              bg = 'light cyan')
        label.pack()
        
        # values of checkbox variables
        toiletPaperS = BooleanVar(pricesSelection)
        toiletPaperL = BooleanVar(pricesSelection)
        handSanitizerS = BooleanVar(pricesSelection)
        handSanitizerL = BooleanVar(pricesSelection)
        waterGal = BooleanVar(pricesSelection)
        waterBot = BooleanVar(pricesSelection)
        wipesS = BooleanVar(pricesSelection)
        wipesL = BooleanVar(pricesSelection)

        # creation of checkboxes
        Checkbutton(pricesSelection, text = 'Toilet Paper (Small Pack, 12)', variable = toiletPaperS, onvalue = 1, offvalue = 0, bg='light cyan').pack()
        Checkbutton(pricesSelection, text = 'Toilet Paper (Bulk, 24)', variable = toiletPaperL, onvalue = 1, offvalue = 0, bg='light cyan').pack()
        Checkbutton(pricesSelection, text = 'Hand Sanitizer (travel size, 2 fl. oz.)', variable = handSanitizerS, onvalue = 1, offvalue = 0, bg='light cyan').pack()
        Checkbutton(pricesSelection, text = 'Hand Sanitizer (medium size, 12 fl. oz.)', variable = handSanitizerL, onvalue = 1, offvalue = 0, bg='light cyan').pack()
        Checkbutton(pricesSelection, text = 'Poland Spring Water Jug (1 Gallon)', variable = waterGal, onvalue = 1, offvalue = 0, bg='light cyan').pack()
        Checkbutton(pricesSelection, text = 'Poland Spring Pack (24 Bottles)', variable = waterBot, onvalue = 1, offvalue = 0, bg='light cyan').pack()
        Checkbutton(pricesSelection, text = 'Heavy Duty Wipes (30 ct)', variable = wipesS, onvalue = 1, offvalue = 0, bg='light cyan').pack()
        Checkbutton(pricesSelection, text = 'Heavy Duty Wipes (60 ct)', variable = wipesL, onvalue = 1, offvalue = 0, bg='light cyan').pack()

        # button that creates graph
        graphPrices = Button(pricesSelection, text = 'Graph Selected', bg='white', command = lambda:pricesData([toiletPaperS, toiletPaperL, handSanitizerS, handSanitizerL, waterGal, waterBot, wipesS, wipesL]))
        graphPrices.place(x=50, y=250)
       
        # button that graphs all
        graphAll = Button(pricesSelection, text = 'Graph All', bg='white', command = lambda:pricesData())
        graphAll.place(x=168, y=250)
       
        # return to menu button
        menuButton = Button(pricesSelection, text = 'Return to Menu', bg='white', command = lambda:menuWindow(pricesSelection))
        menuButton.place(x=250, y=250)
예제 #18
0
 def __init__(self, title, *args, **kwargs):
     Tk.__init__(self, *args, **kwargs)
     self.title(title)
     self.resizable(False, False)
     self.drawBoxes()
     self.mode = BooleanVar()
     self.mode.set(True)
     self.drawChoice()
     self.doBtn = Button(self,
                         text=" Try ",
                         bg="#452",
                         fg="#FFF",
                         command=self._onClick)
     self.doBtn.grid(row=4, column=0, pady=10, padx=5, ipady=2, sticky="we")
     self.bind("<Return>", self._onClick)
예제 #19
0
 def show(self):
     frame = Frame(Interface.functional_area)
     frame.pack(fill=X)
     label = Label(frame, text=self._button_text)
     label.pack(side=LEFT)
     for text, value in self._options:
         var = BooleanVar()
         var.set(value)
         check_button = Checkbutton(frame,
                                    text=text,
                                    variable=var,
                                    onvalue=True,
                                    offvalue=False)
         check_button.pack(side=LEFT)
         self._value_list.append(var)
예제 #20
0
    def title_checkbox(app, parent, on_click=lambda v: v):
        variable = BooleanVar()
        variable.set(TRUE if getattr(app.bot_config, name) else FALSE)

        def command():
            setattr(app.bot_config, name, variable.get())
            write_bot_config(app.bot_config,
                             app.device.serial.replace(':', "_"))
            on_click(variable.get())

        checkbox = Checkbutton(parent,
                               text=text,
                               variable=variable,
                               command=command)
        return checkbox, variable
예제 #21
0
    def __init__(self, window, text=' ', initial=False, command=None):

        self.variable = BooleanVar(window.root, value=initial)

        if command:
            widget = Checkbutton(window.main_frame,
                                 text=text,
                                 variable=self.variable,
                                 command=command)
        else:
            widget = Checkbutton(window.main_frame,
                                 text=text,
                                 variable=self.variable)

        HOPSWidget.__init__(self, window, widget, 'Checkbutton')
예제 #22
0
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.master = master

        self.source_folder = StringVar()
        self.out_folder = StringVar()

        self.quality = StringVar()
        self.quality.set('80')

        self.optimize = BooleanVar()
        self.optimize.set(True)

        self.init()
        self.pack()
예제 #23
0
    def __init__(self, root, engine, flist):
        """Create search dialog for searching for a phrase in the file system.

        Uses SearchDialogBase as the basis for the GUI and a
        searchengine instance to prepare the search.

        Attributes:
            globvar: Value of Text Entry widget for path to search.
            recvar: Boolean value of Checkbutton widget
                    for traversing through subdirectories.
        """
        SearchDialogBase.__init__(self, root, engine)
        self.flist = flist
        self.globvar = StringVar(root)
        self.recvar = BooleanVar(root)
예제 #24
0
    def __create_component(self):
        index = 0

        for index, f in enumerate([
                name for name in os.listdir(self.__folder_path)
                if os.path.isfile(os.path.join(self.__folder_path, name))
        ]):
            self.__check_var.append(BooleanVar())
            self.__check_var[index].set(True)
            self.__check_button_list.append(
                Checkbutton(self,
                            text=f,
                            variable=self.__check_var[index],
                            onvalue=True,
                            offvalue=False,
                            background='blue'))
            self.__check_button_list[index].grid(row=index,
                                                 column=0,
                                                 sticky=W,
                                                 columnspan=2)

        self.__msg_text = Text(self)
        self.__msg_text.grid(row=1, column=2, rowspan=20)
        self.__msg_text.config(state=tkinter.DISABLED)
        self.__msg_text.tag_config('warning',
                                   background='yellow',
                                   foreground='blue')
        self.__msg_text.tag_config('finished',
                                   background='blue',
                                   foreground='white')
        self.__msg_text.tag_config('starting', background='green')
        self.__msg_text.tag_config('error',
                                   background='red',
                                   foreground='yellow')
        Label(self, text='Processing log').grid(row=0, column=2)
        Button(self, text='Invert',
               command=self._invert_checkbutton).grid(row=index + 1, column=0)
        Button(self, text='Select All',
               command=self._select_all_checkbutton).grid(row=index + 2,
                                                          column=0)
        Button(self,
               text='Deselect All',
               command=self._deselect_all_checkbutton).grid(row=index + 2,
                                                            column=1)
        Button(self, text='MagicBack',
               command=self._backup_event).grid(row=index + 3, column=0)
        Button(self, text='Restore',
               command=self._restore_event).grid(row=index + 3, column=1)
예제 #25
0
 def __init__(self,
              master,
              label=None,
              command=None,
              default=False,
              **options):
     super().__init__(master)
     from tkinter import BooleanVar
     from tkinter.ttk import Checkbutton
     self.var = BooleanVar(self.master, value=default)
     self.value = ""
     self.var.trace("w", self.callback)
     self.command = [command]
     if not label is None:
         options.update(text=label)
     self.widget = Checkbutton(self.master, variable=self.var, **options)
예제 #26
0
    def initialize_var(self):
        """
        Initalize all possible variables in the gui.

        Future additions starts here.
        """
        # Inputs
        self.data_file = StringVar(self.root,'Please choose a file')
        self.temp_data_file = StringVar(self.root,'Please choose a file')
        self.output_file = StringVar(self.root,'Please choose a file')
        self.ncomp = IntVar(self.root,'0') # Number of compounds
        self.feff_file = StringVar(self.root,'Please choose a directory')
        self.series = BooleanVar(self.root,'False')
        # Populations
        self.populations = IntVar(self.root,1000)
        self.num_gen = IntVar(self.root,100)
        self.best_sample = IntVar(self.root,20)
        self.lucky_few = IntVar(self.root,20)

        # Mutations
        self.chance_of_mutation = IntVar(self.root,20)
        self.orginal_chance_of_mutation = IntVar(self.root,20)
        self.chance_of_mutation_e0 = IntVar(self.root,20)
        self.mutation_options = IntVar(self.root,0)

        # Paths
        self.individual_path = BooleanVar(self.root,True)
        self.path_range = IntVar(self.root,20)
        temp_list = ",".join(np.char.mod('%i', np.arange(1,self.path_range.get()+1)))
        self.path_list = StringVar(self.root,temp_list)
        self.path_optimize = BooleanVar(self.root,False)
        self.path_optimize_pert = DoubleVar(self.root,0.01)
        self.path_optimize_only = BooleanVar(self.root,False)

        # Larch Paths
        self.kmin = DoubleVar(self.root,2.5)
        self.kmax = DoubleVar(self.root,15)
        self.k_weight = DoubleVar(self.root,2)
        self.delta_k = DoubleVar(self.root,0.05)
        self.r_bkg = DoubleVar(self.root,1.0)
        self.bkg_kw = DoubleVar(self.root, 1.0)
        self.bkg_kmax = DoubleVar(self.root, 15)

        #Outputs
        self.print_graph = BooleanVar(self.root, False)
        self.num_output_paths = BooleanVar(self.root, True)
        self.steady_state_exit = BooleanVar(self.root, True)

        # Pertubutuions
        self.n_ini = IntVar(self.root,100)
예제 #27
0
 def test_find_again(self):
     text = self.text
     self.engine.setpat('')
     self.assertFalse(self.dialog.find_again(text))
     self.dialog.bell = lambda: None
     self.engine.setpat('Hello')
     self.assertTrue(self.dialog.find_again(text))
     self.engine.setpat('Goodbye')
     self.assertFalse(self.dialog.find_again(text))
     self.engine.setpat('World!')
     self.assertTrue(self.dialog.find_again(text))
     self.engine.setpat('Hello World!')
     self.assertTrue(self.dialog.find_again(text))
     self.engine.revar = BooleanVar(self.root, True)
     self.engine.setpat('W[aeiouy]r')
     self.assertTrue(self.dialog.find_again(text))
예제 #28
0
    def __init__(self, name, master=None, **kw):
        """
        Create a  desktop widget that sticks on the desktop.
        """
        Toplevel.__init__(self, master)
        self.name = name
        if CONFIG.getboolean('General', 'splash_supported', fallback=True):
            self.attributes('-type', 'splash')
        else:
            self.attributes('-type', 'toolbar')

        self.style = Style(self)

        self._position = StringVar(self, CONFIG.get(self.name, 'position'))
        self._position.trace_add(
            'write',
            lambda *x: CONFIG.set(self.name, 'position', self._position.get()))

        self.ewmh = EWMH()
        self.title('scheduler.{}'.format(self.name.lower()))

        self.withdraw()

        # control main menu checkbutton
        self.variable = BooleanVar(self, False)

        # --- menu
        self.menu = Menu(self, relief='sunken', activeborderwidth=0)
        self._populate_menu()

        self.create_content(**kw)

        self.x = None
        self.y = None

        # --- geometry
        geometry = CONFIG.get(self.name, 'geometry')
        self.update_idletasks()
        if geometry:
            self.geometry(geometry)
        self.update_idletasks()

        if CONFIG.getboolean(self.name, 'visible', fallback=True):
            self.show()

        # --- bindings
        self.bind('<Configure>', self._on_configure)
예제 #29
0
def weatherprediction():

   frame1.destroy()
   frame2.destroy()
   
   global frame3
   frame3 = Frame(root)
   frame3.pack(side='top',fill='x')

   Label(frame3,text="WEATHER PREDICTION", relief='flat', padx=10,pady=10).grid(row=0,column=0, columnspan=3)
   Label(frame3,text="STEPS", relief='ridge',width=15,bg='white').grid(row=1,column=0)
   Label(frame3,text="PROCESS", relief='ridge',width=25,bg='white').grid(row=1,column=1)
   Label(frame3,text="VALUES", relief='ridge',width=15,bg='white').grid(row=1,column=2)
   steps = ['Step1','Step2','Step3','Step4','Step5','Step6','Step7']
   r = 2
   for c in steps:
     Label(frame3,text=c, relief='ridge',width=15).grid(row=r,column=0)
     r = r + 1

   tr_start1 = tk.Button(frame3, text ="Input Training Set Start Date", command = getTrainSD)
   tr_end1 = tk.Button(frame3, text ="Input Training Set End Date", command = getTrainED)
   test_start1 = tk.Button(frame3, text ="Input Test Set Start Date", command = getTestSD)
   test_end1 = tk.Button(frame3, text ="Input Test Set End Date", command = getTestED)
   dep_var_idx1 = tk.Button(frame3, text ="Choose What to Predict", command = getPredictor)
   indep_var_idx1 = tk.Button(frame3, text ="Choose Plantes", command = getIPredictor)

   def getBool(): # get rid of the event argument
    global feature_scaling
    feature_scaling=boolvar.get()
    Label(frame3,text=feature_scaling, relief='flat',width=15).grid(row=8,column=2)
    print(feature_scaling)

   boolvar = BooleanVar()
   boolvar.set(False)
   boolvar.trace('w', lambda *_: print("The value was changed"))
   cb = tk.Checkbutton(frame3, text = "Is Feature Scaling applicable?", variable = boolvar, command = getBool)
   
   LR = tk.Button(frame3, text = "Run Prediction", command = MLR )

   tr_start1.grid(row=2,column=1)
   tr_end1.grid(row=3,column=1)
   test_start1.grid(row=4,column=1)
   test_end1.grid(row=5,column=1)
   dep_var_idx1.grid(row=6,column=1)
   indep_var_idx1.grid(row=7,column=1)
   cb.grid(row=8,column=1)
   LR.grid(row=9,column=0,columnspan=3)
예제 #30
0
        def wrapper(self, *args):
            self.t_platform_label = Label(text='Язык программирования',
                                          font=font_family)
            self.t_platform_label.place(x=450, y=100, height=30, width=200)
            self.t_platform_input = Entry(font=font_family)
            self.t_platform_input.place(x=700, y=100, height=30, width=240)

            self.t_deadline_label = Label(text='Срок выполнения',
                                          font=font_family)
            self.t_deadline_label.place(x=450, y=150, height=30, width=200)
            self.t_deadline_input = Entry(font=font_family)
            self.t_deadline_input.place(x=700, y=150, height=30, width=240)

            self.t_topic_label = Label(text='Тема', font=font_family)
            self.t_topic_label.place(x=450, y=200, height=30, width=200)
            self.t_topic_input = Entry(font=font_family)
            self.t_topic_input.place(x=700, y=200, height=30, width=240)

            self.t_description_label = Label(text='Описание', font=font_family)
            self.t_description_label.place(x=450, y=250, height=30, width=200)
            self.t_description_input = Text(font=font_family,
                                            background='#f0f0f0',
                                            foreground='#7f7186',
                                            height=12,
                                            width=26)
            self.t_description_input.place(x=700, y=250)

            self.t_promotion_label = Label(text='Продвижение сайта',
                                           font=font_family)
            self.t_promotion_label.place(x=450, y=300, height=30, width=200)
            self.is_promotion_enabled = BooleanVar(value=1)
            self.t_promotion_enabled_button = Radiobutton(
                text='Да',
                width=5,
                variable=self.is_promotion_enabled,
                value=1,
                state=DISABLED)
            self.t_promotion_enabled_button.place(x=485, y=350)
            self.t_promotion_disabled_button = Radiobutton(
                text='Нет',
                width=5,
                variable=self.is_promotion_enabled,
                value=0,
                state=DISABLED)
            self.t_promotion_disabled_button.place(x=565, y=350)
            return func(self, *args)