Exemplo n.º 1
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self._isReady = False
     
     Grid.rowconfigure(self, 0, weight = 1)
     Grid.columnconfigure(self, 0, weight = 1)
     
     # Create a list of all available parsers and their class objects
     self._pList = [(name, parser()) for name, parser
                    in inspect.getmembers(parsers, inspect.isclass)
                    if issubclass(parser, parsers.Parser)
                       and name != 'Parser']
                       
     plugins = _utils.findPlugins('Parser')
     self._pList.extend(((name, parser()) for name, parser in plugins))
     
     # value = 1 prevents PositionParser's config window from opening
     v = IntVar(value = 1) 
     parent = self.master
     for index, (text, _) in enumerate(self._pList):
         b = Radiobutton(
             self, text=text, variable = v, value=index,
             command = lambda: self._configureParser(v, parent))
         b.grid(row = index, column = 0, sticky = W)
     
     # Intialize the parser contained by the LabelFrame
     self._configureParser(v, parent)
     self._isReady = True
Exemplo n.º 2
0
 def __init__(self, root):
     top = Toplevel(master = root)
     top.title('Create a new HDF Datastore')
     frames = {'SelectFilename'     : 0,
               'SelectDatasetTypes' : 1,
               'SelectSearchPath'   : 2,
               'SelectParser'       : 3,
               'Options'            : 4,
               'BuildButton'        : 5}
     Grid.rowconfigure(top, frames['SelectDatasetTypes'], weight = 1)
     Grid.rowconfigure(top, frames['BuildButton'],        weight = 0)
     Grid.columnconfigure(top, 0, weight=1)
 
     # Select filename and path    
     f = self.Frame_SelectFilename(
         master = top, padx = 5, pady = 5,
         text = 'Path and filename for the new datastore')
     f.grid(row = frames['SelectFilename'], sticky = E+W)
     
     # Select dataset types
     t = self.Frame_SelectDatasetTypes(
         master = top, padx = 5, pady = 5,
         text = 'Select dataset types and configure the file reader')
     t.grid(row = frames['SelectDatasetTypes'], sticky = N+S+E+W)
     
     # Select search path
     s = self.Frame_SelectSearchPath(
         master = top, padx = 5, pady = 5,
         text = 'Directory containing input data files')
     s.grid(row = frames['SelectSearchPath'], sticky = E+W)
     
     # Select parser
     p = self.Frame_SelectParser(
         master = top, padx = 5, pady = 5,
         text = 'Select and configure the filename parser')
     p.grid(row = frames['SelectParser'], sticky = E+W)
     
     # Optional arguments for readingFromFiles
     o = self.Frame_SelectOptions(
         master = top, padx = 5, pady = 5,
         text = 'Miscellaneous build options')
     o.grid(row = frames['Options'], sticky = E+W)
     
     frameParams = (f, t, s, p, o)
     build = Button(
         master = top, text = 'Build',
         command=lambda: self._buildDatabase(self, top, frameParams))
     build.grid(row = frames['BuildButton'])
     
     # Make this window modal
     top.transient(root)
     top.grab_set()
     root.wait_window(top)
Exemplo n.º 3
0
 def __init__(self):
     self._root = Tk()
     self._root.geometry("500x400")
     self._root.title("IMGPDF")
     self._Elements()
     Grid.rowconfigure(self._root, 0, weight=1)
     Grid.columnconfigure(self._root, 0, weight=1)
     self.supportedfiles = [
         ('PDF files', '*.pdf*'), ('jpg files', '*.jpg*'),
         ('png files', '*.png*'), ('gif files', '*.gif*'),
         ('All files', '*.*')
     ]
     self.openfiles = []
     self._root.mainloop()
Exemplo n.º 4
0
    def __init__(self, master):
        """initialize GUI"""
        self.root = master
        self.on = True
        self.connection = None
        Tk().withdraw()
        self.basicframe = Frame(self.root)
        self.basicframe.grid()
        self.basicframe.configure(bg=bgcolor)

        self.fr = Frame(self.basicframe)
        self.fr.grid(row=0, column=0, sticky='new')  # , sticky='W')
        self.fr.configure(bg=bgcolor)
        Grid.columnconfigure(self.root, 0, weight=1)

        self.port = None
        self.baud = None
        # self.inputTypes = ['ascii', 'bin', 'hex', 'mix']
        self.inputType = StringVar()
        self.inputType.set('ascii')
        self.input = 'ascii'

        self.labelPort = Label(self.fr, width=10, text='PORT', justify='left', anchor='w', bg=bgcolor, fg=fgcolor, font=("Calibri", 12))
        self.entryPort = Entry(self.fr, width=20, bd=3, justify='left', bg=inputbox, fg=fgcolor)

        self.labelBaud = Label(self.fr, text='BAUD', justify='left', anchor='w', bg=bgcolor, fg=fgcolor, font=("Calibri", 12))
        self.entryBaud = Entry(self.fr, width=20, bd=3, justify='right', bg=inputbox, fg=fgcolor)

        self.labelType = Label(self.fr, text='TYPE', justify='left', anchor='w', bg=bgcolor, fg=fgcolor, font=("Calibri", 12))
        self.radioType1 = Radiobutton(self.fr, text='ascii', variable=self.inputType, value='ascii', indicatoron=0)
        self.radioType2 = Radiobutton(self.fr, text='bin', variable=self.inputType, value='bin', width=20, indicatoron=0)
        self.radioType3 = Radiobutton(self.fr, text='hex', variable=self.inputType, value='hex', indicatoron=0)
        self.radioType4 = Radiobutton(self.fr, text='mix', variable=self.inputType, value='mix', width=20, indicatoron=0)

        self.labelInput = Label(self.fr, text='INPUT', justify='left', anchor='w', bg=bgcolor, fg=fgcolor, font=("Calibri", 12))
        self.entryInput = Entry(self.fr, width=20, bd=3, justify='left', bg=inputbox, fg=fgcolor)

        self.buttonSend = Button(self.fr, text='SEND', justify='center', bg=buttoncolor, command=self.send)
        self.buttonRead = Button(self.fr, text='READ', justify='center', bg=buttoncolor, command=self.read)
        self.buttonExit = Button(self.fr, text='EXIT', justify='center', bg='red', fg='white', command=self.exit)

        self.response = StringVar()
        self.response.set('')
        self.responseBar = Label(self.fr, textvariable=self.response, justify='left', anchor='w',
                                 bg=bgcolor, fg=fgcolor, font=("Calibri", 12))
        self.status = StringVar()
        self.statusBar = Label(self.fr, textvariable=self.status, justify='left', anchor='nw',
                               bg=bgcolor, fg=fgcolor, font=("Calibri", 10))
        self.status.set('Initialized')
Exemplo n.º 5
0
    def __init__(self, master):
        self.master = master
        self.master.geometry("270x270")
        self.frame = tk.Frame(self.master)
        self.prediction_dataset = None

        Label(self.frame, text="Main Menu",
              font='Helvetica 10 bold').grid(row=0,
                                             column=1,
                                             columnspan=3,
                                             sticky=N + S + E + W,
                                             pady=3)
        Label(self.frame, text="Mode:").grid(row=1,
                                             column=1,
                                             sticky=N + S + E + W,
                                             pady=3)
        self.mode_box = ttk.Combobox(self.frame,
                                     state="readonly",
                                     values=["DoS", "Mechanical"])
        self.mode_box.current(0)
        self.mode_box.grid(row=1,
                           column=2,
                           columnspan=2,
                           stick=N + S + E + W,
                           pady=3)

        Button(self.frame,
               text='Composition Scan',
               command=self.compositionFrame).grid(row=2,
                                                   column=1,
                                                   columnspan=3,
                                                   rowspan=2,
                                                   sticky=N + S + E + W,
                                                   pady=3)
        Button(self.frame,
               text="Predict Output",
               command=self.openPredictionThread).grid(row=4,
                                                       column=1,
                                                       columnspan=3,
                                                       rowspan=2,
                                                       sticky=N + S + E + W,
                                                       pady=3)

        # Formatting
        for x in range(5):
            Grid.columnconfigure(self.frame, x, weight=1)
        for y in range(7):
            Grid.rowconfigure(self.frame, y, weight=1)
        self.frame.pack(anchor=N, fill=BOTH, expand=True, side=LEFT)
Exemplo n.º 6
0
        def __init__(self, **kwargs):
            super().__init__(**kwargs)
            self._isReady = True

            Grid.columnconfigure(self, 1, weight=1)

            self.button = Button(self,
                                 text='Help',
                                 command=openMiscHelp,
                                 width=10)
            self.button.grid(row=0, column=1, padx=5, pady=5, sticky=E)

            self._kwargs = Entry(self, width=65)
            self._kwargs.delete(0, END)
            self._kwargs.insert(0, '\'sep\' : \',\', \'readTiffTags\' : False')
            self._kwargs.grid(row=0, column=0, padx=5, pady=5, sticky=W)
Exemplo n.º 7
0
    def __init__(self, update_slider_range: Callable[[Event], None],
                 draw_field: Callable[[Event], None]) -> None:
        # programs can only have one window, but can
        # create multiple "Toplevel"s (effectively new windows)
        self.window = Toplevel()
        self.window.title('HexSweeper - Choose Difficulty')
        self.window.geometry('400x473')
        self.window.bind('<Configure>', draw_field)

        # these statements allow the hexgrid (in col 1, row 3)
        # to stretch as the window is resized

        # stretch the second column horizontally:
        Grid.columnconfigure(self.window, 1, weight=1)
        # stretch the fourth row vertically:
        Grid.rowconfigure(self.window, 3, weight=1)

        Label(self.window, text='Board Size:').grid(row=0, column=0, sticky=W)

        # TkInter "Scale" objects are sliders
        # Default slider resolution/accuracy is 1
        self.game_size_slider = Scale(
            self.window,
            # from_ because from is a Python keyword
            from_=2,
            to=15,
            orient=HORIZONTAL,
            command=update_slider_range)
        self.game_size_slider.grid(row=0, column=1, sticky=E + W)

        Label(self.window, text='Number of mines:') \
            .grid(row=1, column=0, sticky=W)
        self.mine_count_slider = Scale(self.window,
                                       from_=1,
                                       to=315,
                                       orient=HORIZONTAL,
                                       command=draw_field)
        self.mine_count_slider.grid(row=1, column=1, sticky=E + W)

        self.canvas = Canvas(self.window, bg='white')
        self.canvas.grid(
            row=3,
            column=0,
            # span columns 0 and 1
            columnspan=2,
            # resize with the window
            sticky=E + N + W + S)
Exemplo n.º 8
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self._isReady = True
     
     Grid.columnconfigure(self, 1, weight = 1)
     
     self.button = Button(self, text='Help',
                          command=openMiscHelp, width=10)
     self.button.grid(row = 0, column=1,
                      padx = 5, pady = 5, sticky = E)        
     
                
     
     self._kwargs = Entry(self, width = 65)
     self._kwargs.delete(0, END)
     self._kwargs.insert(0, '\'sep\' : \',\', \'readTiffTags\' : False')
     self._kwargs.grid(row = 0, column = 0,
         padx = 5, pady = 5, sticky = W)
Exemplo n.º 9
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self._isReady = False
     self.filename = None
     
     Grid.columnconfigure(self, 1, weight = 1)
     
     self.button = Button(self, text="Browse",
                          command=self.loadFile, width=10)
     self.button.grid(row = 0, column=1,
                      padx = 5, pady = 5, sticky = E)        
     
     self.entry = Entry(self, width = 65)
     self.entry.delete(0, END)
     self.entry.insert(0, 'Enter a path to a new datastore file...')
     self.entry.grid(row = 0, column = 0,
                     padx = 5, pady = 5, sticky = W)
     self.entry.configure(state = 'readonly')
Exemplo n.º 10
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self._isReady   = False
     self.searchPath = None
     
     Grid.columnconfigure(self, 1, weight = 1)
     
     self.button = Button(self, text="Browse",
                          command=self.loadFile, width=10)
     self.button.grid(row=0, column=1,
                      padx = 5, pady = 5, sticky = E)        
     
     self.entry = Entry(self, width = 65)
     self.entry.delete(0, END)
     self.entry.insert(
         0, 'Enter the directory containing the input files...')
     self.entry.grid(row = 0, column = 0,
                     padx = 5, pady = 5, sticky = W)
     self.entry.configure(state = 'readonly')
Exemplo n.º 11
0
    def __init__(self, parent: Tk, view_model: MainWindowViewModel, *args, **kwargs):
        super().__init__(parent, *args, **kwargs)   # call parent constructor
        Grid.rowconfigure(parent, 0, weight=1)
        Grid.columnconfigure(parent, 0, weight=1)
        self._root = parent        # save reference to ui hierarchy root
        self._context = view_model # set data context of the main window
        self._table_settings_path = './table_settings.json'
        self._analyzer_settings_path = './analyzer_settings.json'
        self._source_settings_path = './source_settings.json'
        self._sidetone_settings_path = './sidetone_settings.json'
        self._plot_options_settings_path = './plot_options_settings.json'
        self._root.title(self._context.application_title) # window title
        self._root.geometry('{}x{}'.format(self._context.app_width, self._context.app_height))   # window size

        # connect to event in case the application closes and an experiment is still running.
        parent.protocol("WM_DELETE_WINDOW", self._on_close_)

        self.grid(row=0, column=0)  # place window in root element
        self._setup_()            # setup the main window content
Exemplo n.º 12
0
    def optionsWinSetup(self):
        #Setting up the options window
        if self._gameWin:
            return
        optionsWin = Toplevel(self._root)
        optionsWin.title('Options')
        self._optionsWin = optionsWin
        Grid.rowconfigure(optionsWin, 0, weight=1)
        Grid.columnconfigure(optionsWin, 0, weight=1)
        frame = Frame(optionsWin)
        frame.grid(row=0, column=0, sticky=N + S + E + W)

        dims = [3, 4, 5, 6, 7, 8, 9]
        dim = StringVar()
        dim.set(dims[1])
        m = OptionMenu(frame, dim, *dims)
        m.grid(row=0, column=1, sticky=N + S + E + W)

        ais = ['None', 'Player 1', 'Player 2']
        ai = StringVar()
        ai.set(ais[0])
        m = OptionMenu(frame, ai, *ais)
        m.grid(row=1, column=1, sticky=N + S + E + W)

        difficulties = ['Easy', 'Medium', 'Hard']
        difficulty = StringVar()
        difficulty.set(difficulties[1])
        m = OptionMenu(frame, difficulty, *difficulties)
        m.grid(row=2, column=1, sticky=N + S + E + W)

        Label(frame, text='Board dimension: ').grid(row=0,
                                                    column=0,
                                                    sticky=N + S + E + W)
        Label(frame, text='AI: ').grid(row=1, column=0, sticky=N + S + E + W)
        Label(frame, text='AI difficulty: ').grid(row=2,
                                                  column=0,
                                                  sticky=N + S + E + W)

        cmd = lambda: self.closeOptions(dim, ai, difficulty)
        Button(optionsWin, text='Play', command=cmd).grid(row=3, column=0)
        Grid.rowconfigure(frame, 0, weight=1)
        Grid.columnconfigure(frame, 0, weight=1)
    def __init__(self, board):

        self.root = Tk()
        self.board = board

        root = self.root
        root.geometry("500x500")
        Grid.rowconfigure(root, 0, weight=1)
        Grid.columnconfigure(root, 0, weight=1)

        frame = Frame(root)
        frame.grid(row=0, column=0, sticky=N + S + E + W)

        for r in range(board.nrow):
            Grid.rowconfigure(frame, r, weight=1)
            for c in range(board.ncol):
                Grid.columnconfigure(frame, c, weight=1)
                btn = Button(frame)
                btn.grid(row=r, column=c, sticky=N + S + E + W)
                board.grid[r][c].btn = btn
Exemplo n.º 14
0
    def helpCallback(self):
        #What happens when the help button is pressed
        helpWin = Toplevel(self._root)
        helpWin.title('Help')
        self._helpWin = helpWin
        Grid.rowconfigure(helpWin, 0, weight=1)
        Grid.columnconfigure(helpWin, 0, weight=1)
        frame = Frame(helpWin)
        frame.grid(row=0, column=0, sticky=N + S + E + W)

        l = Label(
            frame,
            text=
            'Dots and Boxes is a two player game in which players take it in turns to play lines on a grid to make boxes.\nWhoever has captured the most boxes when all of the lines have been played is the winner.\n\nPress on the buttons between the dots to play a line.\nIf you capture a box, you get another turn.'
        )
        l.grid(row=0, column=0, sticky=N + S + E + W)
        Grid.rowconfigure(frame, 0, weight=1)
        Grid.columnconfigure(frame, 0, weight=1)

        Button(helpWin, text='Dismiss', command=self._helpClose).grid(row=1,
                                                                      column=0)
    def __init__(self, win):
        self.window = win
        self.lbl1 = Label(win, text='iRODS Username:'******'iRODS Password:'******'Login', command=self.login)

        self.window.grid()
        Grid.rowconfigure(self.window, 0, weight=1)
        Grid.rowconfigure(self.window, 1, weight=1)
        Grid.rowconfigure(self.window, 2, weight=1)
        Grid.rowconfigure(self.window, 3, weight=1)
        Grid.rowconfigure(self.window, 4, weight=1)
        Grid.columnconfigure(self.window, 0, weight=1)

        self.lbl1.grid(row=0, column=0, padx="20", pady="1", sticky="w")
        self.t1.grid(row=1, column=0, padx="10", pady="1", sticky="nsew")
        self.lbl2.grid(row=2, column=0, padx="20", pady="1", sticky="w")
        self.t2.grid(row=3, column=0, padx="10", pady="1", sticky="nsew")
        self.b1.grid(row=4, column=0, padx="50", pady="10", sticky="nsew")
Exemplo n.º 16
0
    def initUI(self):

        self.parent.title("Beanee - Convert your banking files")
        self.pack(fill=BOTH, expand=1)

        self.headerFrame = Frame(self)
        self.headerFrame.pack(fill=X, padx=10, pady=10)
        Separator(self, orient='horizontal').pack(fill=X)
        self.bodyFrame = Frame(self)
        self.bodyFrame.pack(fill=BOTH, expand=1)
        Separator(self, orient='horizontal').pack(fill=X)
        self.bottomFrame = Frame(self)
        self.bottomFrame.pack(side=BOTTOM, fill=X, padx=10, pady=10)

        Grid.columnconfigure(self.bodyFrame, 0, weight=1)
        Grid.columnconfigure(self.bottomFrame, 0, weight=1)
        Grid.rowconfigure(self.bottomFrame, 0, weight=1)

        self.sep = Separator(self.bodyFrame, orient='horizontal')
        self.sep.grid(row=0, sticky=W + E)

        self.addFileButton = Button(self.bodyFrame,
                                    text='Add File',
                                    command=self.addFile)
        self.addFileButton.grid(row=1, sticky=E + W)

        self.addLedgerDialog(self.headerFrame)

        self.storeLedgerButton = Button(self.bottomFrame,
                                        text='Store Ledger',
                                        command=self.storeLedger)
        self.storeLedgerButton.grid(column=0, row=0, sticky=E + W)

        Separator(self.bottomFrame, orient='horizontal').grid(row=1,
                                                              sticky=E + W)
        Label(self.bottomFrame,
              text='Beancount Import Manager - Version {}'.format(
                  beancountManager.__version__)).grid(row=2)

        self.toggleIntroText()
Exemplo n.º 17
0
    def __init__(self):
        self.root = tkinter.Tk()
        self.root.wm_title("Electrihive")
        tkinter.Frame.__init__(self, self.root)

        self.mutex = Lock()
        self.solution = None
        self.iter_count = None

        Grid.rowconfigure(self.root, 0, weight=1)
        Grid.columnconfigure(self.root, 0, weight=1)
        self.grid(row=0, column=0, sticky=tkinter.NSEW)

        self.optionsview = OptionsView(self)
        self.graphview = GraphView(self)
        self.solutionview = SolutionView(self)

        Grid.rowconfigure(self, 0, weight=1)
        Grid.rowconfigure(self, 2, weight=1)
        Grid.columnconfigure(self, 0, weight=1)
        Grid.columnconfigure(self, 1, weight=4)

        self.optionsview.grid(row=0,
                              column=0,
                              columnspan=1,
                              sticky=tkinter.NSEW)
        self.graphview.grid(row=0,
                            column=1,
                            columnspan=5,
                            rowspan=2,
                            sticky=tkinter.NSEW)
        self.solutionview.grid(row=1,
                               column=0,
                               columnspan=1,
                               sticky=tkinter.NSEW)
Exemplo n.º 18
0
    def init_gui(self):
        self.top_level.geometry("400x450")
        Message(self.top_level, text=self.product.title,
                width=380).grid(row=0,
                                column=0,
                                columnspan=2,
                                sticky=N + S + W + E)

        # May want to customize in near future
        link_label = Label(self.top_level,
                           text="Emag - Link to shop",
                           fg="blue",
                           cursor="hand2")
        link_label.grid(row=1, column=1, sticky=N + S + W + E)
        link_label.bind('<Button-1>', self.open_browser)

        response = requests.get(self.product.image_link)
        self.bin_img = response.content

        self.mem_image = ImageTk.PhotoImage(
            Image.open(BytesIO(self.bin_img)).resize((150, 150)))
        panel = Label(self.top_level, image=self.mem_image)
        panel.grid(row=1, column=0, rowspan=2, sticky=N + S + W + E)

        Label(self.top_level,
              text='Current price: ' + str(self.product.new_price) +
              ' ron').grid(row=2, column=1)

        text_bu = 'Add'
        self.add_bu = Button(self.top_level,
                             text=text_bu,
                             command=self.add_product)
        self.add_bu.grid(row=3, column=0, columnspan=2, sticky=N + S + W + E)
        if self.already_exists:
            self.add_bu.config(state=DISABLED)

        for x in range(4):
            Grid.rowconfigure(self.top_level, x, weight=1)
        for x in range(2):
            Grid.columnconfigure(self.top_level, x, weight=1)
Exemplo n.º 19
0
    def __init__(self,
                 data=[],
                 auto_push=False,
                 title="NetworkTables Tuning Tool",
                 w=200,
                 h=400):
        self.height = 1
        self.auto_push = auto_push
        super().__init__()
        Grid.columnconfigure(self, 0, weight=1)
        Grid.columnconfigure(self, 1, weight=1)
        self.after(50, self.update)
        self.title(title)

        self.frame = ttk.Frame(self, padding=40)
        self.frame.grid(sticky=N + S + E + W)

        self.add_slider_button = ttk.Button(self, text="New Slider")
        self.add_slider_button.grid(column=0, row=0, sticky=N + S + W + E)
        self.add_slider_button['command'] = lambda: self.add_slider()

        self.remove_slider_button = ttk.Button(self, text="Remove Slider")
        self.remove_slider_button.grid(column=1, row=0, sticky=N + S + E + W)
        self.remove_slider_button['command'] = lambda: self.remove_slider()

        if not self.auto_push:
            self.push_button = ttk.Button(self, text="Push")
            self.push_button.grid(column=2, row=0, sticky=N + S + E + W)
            self.push_button['command'] = lambda: self.push()

        self.save_button = ttk.Button(self, text="Save")
        self.save_button.grid(column=3, row=0, sticky=N + S + E + W)
        self.save_button['command'] = lambda: self.save()

        self.sliders = []
        self.data = data
        for saved in self.data:
            print(saved)
            self.add_slider(*saved)
Exemplo n.º 20
0
    def __init__(self, root: Tk, model: Model):
        self.model = model

        Grid.rowconfigure(root, 0, weight=1)
        Grid.columnconfigure(root, 0, weight=1)

        # Horizontal PanedWindow
        pw = ttk.PanedWindow(root, orient=HORIZONTAL)
        self.pw = pw
        pw.grid(column=0, row=0, sticky="nesw")

        # Card selection
        cards_frame = ttk.LabelFrame(pw, text="Cards")
        pw.add(cards_frame)
        cards_tree = ttk.Treeview(cards_frame,
                                  show="tree",
                                  selectmode="browse")
        self.cards_tree = cards_tree
        self.render_card_list()
        cards_tree.bind("<<TreeviewSelect>>", self._on_select_card)
        cards_tree.grid(column=0, row=0, sticky="nesw")
        Grid.rowconfigure(cards_frame, 0, weight=1)
        Grid.columnconfigure(cards_frame, 0, weight=1)

        # Main text editor
        text_editor = Text(pw)
        self.text_editor = text_editor
        text_editor.bind("<Control-a>", self._on_text_ctrl_a)
        pw.add(text_editor)

        # Rightmost vertical paned window
        vpw = ttk.PanedWindow(pw, orient=VERTICAL)
        pw.add(vpw)

        ## Template picker
        templates_frame = ttk.LabelFrame(vpw, text="Templates")
        vpw.add(templates_frame)
        templates_tree = ttk.Treeview(templates_frame, show="tree")
        templates_tree.grid(column=0, row=0, sticky="nsew")
        Grid.rowconfigure(templates_frame, 0, weight=1)
        Grid.columnconfigure(templates_frame, 0, weight=1)
        self.templates_tree = templates_tree
        self.render_template_list()
        templates_tree.bind("<<TreeviewSelect>>", self._on_select_template)

        ## Preview
        preview_frame = ttk.LabelFrame(vpw,
                                       text="Preview",
                                       height=300,
                                       width=300)
        vpw.add(preview_frame)

        style = ttk.Style()
        if sys.platform == "win32":
            style.theme_use("vista")
        elif sys.platform == "darwin":
            style.theme_use("aqua")
        else:
            style.theme_use("clam")
    def __init__(self, win):
        global session, iRODSCredentials
        self.session = session
        self.window = win
        self.b1 = Button(win, text='Select', command=self.select)
        self.lb1 = Listbox(win)

        self.window.grid()
        Grid.rowconfigure(self.window, 0, weight=1)
        Grid.rowconfigure(self.window, 1, weight=1)
        Grid.columnconfigure(self.window, 0, weight=1)

        self.lb1.grid(row=0, column=0, padx="20", pady="1", sticky="nswe")
        self.b1.grid(row=1, column=0, padx="50", pady="1", sticky="ew")

        coll = session.collections.get("/" + iRODSCredentials["zone"] + "/" + "home" + "/" + iRODSCredentials["user"])
        file_list = []

        self.get_files_from_collections(coll, file_list)

        for counter in range(len(file_list)):
            self.lb1.insert(counter, file_list[counter])
Exemplo n.º 22
0
    def _play_callback(self):
        if self._game_win:
            return

        self._game = Game()
        self._finished = False

        game_win = Toplevel(self._root)
        game_win.title("Game")
        frame = Frame(game_win)

        # To allow resizing
        Grid.columnconfigure(game_win, 0, weight=1)
        Grid.rowconfigure(game_win, 0, weight=1)
        frame.grid(row=0, column=0, sticky=N + S + E + W)

        dim = self._game.dim()
        self._buttons = [[None for _ in range(dim)] for _ in range(dim)]

        for row, col in product(range(dim), range(dim)):
            b = StringVar()
            b.set(self._game.at(row + 1, col + 1))

            cmd = lambda r=row, c=col: self._play_and_refresh(r, c)

            Button(frame, textvariable=b,
                   command=cmd).grid(row=row, column=col, sticky=N + S + E + W)

            self._buttons[row][col] = b

        # To allow resizing
        for i in range(dim):
            Grid.rowconfigure(frame, i, weight=1)
            Grid.columnconfigure(frame, i, weight=1)

        Button(game_win, text="Dismiss",
               command=self._game_close).grid(row=1, column=0)
        self._game_win = game_win
Exemplo n.º 23
0
        def __init__(self, **kwargs):
            super().__init__(**kwargs)
            self._isReady = False
            self.filename = StringVar()
            self.filename.set('')

            Grid.columnconfigure(self, 1, weight=1)

            self.button = Button(self,
                                 text="Browse",
                                 command=self.loadFile,
                                 width=10)
            self.button.grid(row=0, column=1, padx=5, pady=5, sticky=E)

            self.entry = Entry(self, width=65, textvariable=self.filename)
            self.entry.delete(0, END)
            self.entry.insert(0, 'Enter a path to a new datastore file...')
            self.entry.grid(row=0, column=0, padx=5, pady=5, sticky=W)

            def setReady(a, b, c):
                self._isReady = True

            self.filename.trace('w', setReady)
Exemplo n.º 24
0
 def grid_config(self):
     Grid.columnconfigure(self.root, 0, weight=1)
     Grid.rowconfigure(self.root, 0, weight=1)
     Grid.columnconfigure(self.container, 0, weight=1)
     Grid.rowconfigure(self.container, 0, weight=1)
     for x in range(3):
         Grid.columnconfigure(self.frame, x, weight=1)
     for y in range(3):
         Grid.rowconfigure(self.frame, y, weight=1)
Exemplo n.º 25
0
        def __init__(self, **kwargs):
            super().__init__(**kwargs)
            self._isReady = False
            self.searchPath = StringVar()
            self.searchPath.set('')

            Grid.columnconfigure(self, 1, weight=1)

            self.button = Button(self,
                                 text="Browse",
                                 command=self.loadFile,
                                 width=10)
            self.button.grid(row=0, column=1, padx=5, pady=5, sticky=E)

            self.entry = Entry(self, width=65, textvariable=self.searchPath)
            self.entry.delete(0, END)
            self.entry.insert(
                0, 'Enter the directory containing the input files...')
            self.entry.grid(row=0, column=0, padx=5, pady=5, sticky=W)

            def setReady(a, b, c):
                self._isReady = True

            self.searchPath.trace('w', setReady)
Exemplo n.º 26
0
    def __init__(self, master):
        Frame.__init__(self, master)

        self._regex_var = StringVar(self)
        self._regex_var.set('.*')
        self._regex_var.trace('w', self._validate)
        self._regex_value = re.compile(self._regex_var.get())

        self._repl_var = StringVar(self)
        self._repl_var.set(r'\0')
        self._repl_var.trace('w', self._validate)
        self._repl_value = r'\g<0>'

        Grid.columnconfigure(self, 1, weight=1)

        regex_label = Label(self, text="Regex:")
        regex_label.grid(column=0, row=0, sticky='w', padx=(0, 5))
        self._regex_entry = Entry(self, textvariable=self._regex_var)
        self._regex_entry.grid(column=1, row=0, sticky='we')

        repl_label = Label(self, text="Replacement:")
        repl_label.grid(column=0, row=1, sticky='w', padx=(0, 5))
        self._repl_entry = Entry(self, textvariable=self._repl_var)
        self._repl_entry.grid(column=1, row=1, sticky='we')
Exemplo n.º 27
0
    def __init__(self,frame_name):
        tk.Tk.__init__(self)

        #Global Variable
        numberofcolumns = 3
        self.title_content = ''

        for i in range(0,numberofcolumns):
            #Grid.rowconfigure(self, i+1, weight=1)
            Grid.columnconfigure(self, i, weight=1)
        #All the frames
        self.frames = {}
        self.frames['HomePage'] = HomePage(self)
        self.frames['HingePrediction'] = HingePrediction(self)
        self.frames['hdANM_GUI'] = hdANM_GUI(self)
        self.frames['Voronoi_Packing_Entropy_GUI'] = Voronoi_Packing_Entropy_GUI(self)
        self.frames['TopMenu'] = top_menu(self)

        self.geometry("800x600")

        #Icon for windows
        try:
            self.iconbitmap(False, os.path.abspath(os.path.dirname(__file__)+'/logo.ico') )
        except:
            None
        
        self.show_frame(frame_name)

        try:
            self.title_content = "PACKMAN "+get_version( os.path.abspath(os.path.dirname(__file__)).replace('bin','__init__.py') )+" GUI"
            self.title( self.title_content )
        except:
            self.title_content = "PACKMAN GUI"
            self.title( self.title_content )
            showinfo('Notification', 'PACKMAN was not loaded properly or has older version than 1.1.3\n\nTry:\n\npython -n pip install packman\npython -n pip install packman --upgrade')
            self.focus_force()
Exemplo n.º 28
0
    def __init__(self, parent, rows, columns):
        super().__init__(parent, borderwidth=0)
        self.canvas = tk.Canvas(self, highlightthickness=0)
        self.canvas.grid(row=0, column=0, sticky='news')
        self.scrollbar = tk.Scrollbar(self,
                                      orient='vertical',
                                      command=self.canvas.yview)
        self.scrollbar.grid(row=0, column=1, sticky='ns')
        self.canvas.configure(yscrollcommand=self.scrollbar.set)
        self.inner = tk.Frame(self.canvas, borderwidth=0)
        self.window = self.canvas.create_window((0, 0),
                                                window=self.inner,
                                                anchor='nw')
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)
        self.inner.bind('<Configure>', self.resize)
        self.canvas.bind('<Configure>', self.frameWidth)
        self.num_rows = rows
        self.num_columns = columns

        for x in range(self.num_columns):
            Grid.columnconfigure(self.inner, x, weight=1)
        for y in range(self.num_rows):
            Grid.rowconfigure(self.inner, y, weight=1)
Exemplo n.º 29
0
    def __init__(self, master, height, width, list_labels):
        super().__init__()
        self.height = height
        self.width = width

        self.master = master

        self.frame = Frame(self.master)
        Grid.rowconfigure(self.master, 0, weight=1)
        Grid.columnconfigure(self.master, 0, weight=1)
        self.frame.grid(row=0, column=0, sticky=N + S + E + W)
        grid = Frame(self.frame)
        grid.grid(sticky=N + S + E + W, column=0, row=7, columnspan=2)
        Grid.rowconfigure(self.frame, 7, weight=1)
        Grid.columnconfigure(self.frame, 0, weight=1)

        self.labelVar = None
        self.changes_list = []

        n_column_buttons = 3
        list_labels.append("NOT_VME")
        n_row_buttons = math.ceil(float(len(list_labels)) / n_column_buttons)
        cmpt_label = 0
        list_btn = []  # creates list to store the buttons ins
        for x in range(n_column_buttons):
            for y in range(n_row_buttons):
                if cmpt_label < len(list_labels):
                    list_btn.append(
                        Button(self.frame,
                               text=list_labels[cmpt_label],
                               command=lambda c=cmpt_label: self.set_label(
                                   list_btn[c].cget("text"))))
                    list_btn[cmpt_label].grid(column=x,
                                              row=y,
                                              sticky=N + S + E + W)
                    cmpt_label += 1

        for x in range(n_column_buttons):
            Grid.columnconfigure(self.frame, x, weight=1)
        for y in range(n_row_buttons):
            Grid.rowconfigure(self.frame, y, weight=1)

        self.accept_key = IntVar()
        self.master.bind("a", self.accept)
        self.master.bind("q", self.quit)
        self.quit_ = False
    Main(colours, rowLineCounter.get(), bingoURL.get(), bingoPW.get(),
         videoOrImage.get(), bingoImgPath.get())


def finish():
    sys.exit(0)


b = Button(top, text="Start Tracker", bg="#cccccc",
           command=callback).grid(sticky=W + E,
                                  row=40,
                                  column=0,
                                  columnspan=3,
                                  padx=10,
                                  pady=(8, 0))
c = Button(top, text="Exit", bg="#cccccc", command=finish).grid(sticky=W + E,
                                                                row=41,
                                                                column=0,
                                                                columnspan=3,
                                                                padx=10,
                                                                pady=2)

for x in range(3):
    Grid.columnconfigure(top, x, weight=1)
for y in range(15):
    Grid.rowconfigure(top, y, weight=1)

top.title("BingoTracker")
top.mainloop()
Exemplo n.º 31
0
def week_frame(weekIndex):
    weekFrame = pageFrame(master)

    weekTable = tk.Frame(weekFrame, bg=FRAME_BG_COLOR)
    weekTable.place(relx=1 / 2,
                    rely=1 / 6,
                    anchor="n",
                    relwidth=1 / 2,
                    relheight=1)

    title = tk.Label(weekFrame,
                     text="Week Balance",
                     bg=FRAME_BG_COLOR,
                     font=(FONT, 28),
                     fg="white")
    title.place(relx=1 / 2, anchor="n")

    week = gd.getWeek(weekIndex)
    daysOfWeek = [
        "#", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
        "Saturday", "Sunday"
    ]

    previousButton = tk.Button(weekFrame,
                               bg=GREEN,
                               text="PREVIOUS",
                               font=(FONT, 16),
                               fg="white",
                               relief="flat",
                               command=lambda: week_frame(weekIndex - 1))
    previousButton.place(relx=1 / 2,
                         rely=3 / 4,
                         relwidth=1 / 12,
                         anchor="e",
                         relheight=1 / 24)

    nextButton = tk.Button(weekFrame,
                           bg=GREEN,
                           text="NEXT",
                           font=(FONT, 16),
                           fg="white",
                           relief="flat",
                           command=lambda: week_frame(weekIndex + 1))
    nextButton.place(relx=1 / 2,
                     rely=3 / 4,
                     relwidth=1 / 24,
                     anchor="w",
                     relheight=1 / 24)

    for day in daysOfWeek:
        label1 = tk.Label(weekTable,
                          text=day,
                          bg=FRAME_BG_COLOR,
                          font=(FONT, 12),
                          fg="white")
        label1.grid(row=0, column=daysOfWeek.index(day), sticky="W")

    for i in range(1, 37):
        label1 = tk.Label(weekTable,
                          text=str(i),
                          bg=FRAME_BG_COLOR,
                          font=(FONT, 12),
                          fg="white")
        label1.grid(row=i, column=0, sticky="W")

    for x in range(60):
        Grid.columnconfigure(weekTable, x, weight=1)

    for y in range(60):
        Grid.rowconfigure(weekTable, y, weight=1)

    for day in week:
        for pom in day[1]:
            label1 = tk.Label(weekTable,
                              text=pom[3],
                              bg=FRAME_BG_COLOR,
                              font=(FONT, 12),
                              fg="white")
            label1.grid(row=day[1].index(pom) + 1,
                        column=day[0].weekday() + 1,
                        sticky="W")
Exemplo n.º 32
0
    def setup_window(self):
        # initial setup
        self.primary_window = Tk()
        self.open_images()
        self.primary_window.wm_title("Rubiks_Main")
        self.primary_window.geometry('1111x777-1+0')
        # self.primary_window.geometry('1274x960+1274-1055')
        self.primary_window.minsize(width=100, height=30)
        self.primary_window.maxsize(width=self.max_win_size[0],
                                    height=self.max_win_size[1])

        # canvases
        self.im_frame = ttk.Frame(self.primary_window)
        self.im_frame.grid(row=0, column=0, columnspan=4, sticky="nsew")
        self.im_frame.columnconfigure(0, weight=1)
        self.im_frame.rowconfigure(0, weight=1)
        self.primary_window.columnconfigure(0, weight=1)
        self.primary_window.rowconfigure(0, weight=1)

        self.canvas1 = Canvas(self.im_frame,
                              width=self.canvas_dimension,
                              height=self.canvas_dimension,
                              background='black')
        self.canvas1.grid(row=0, column=0, sticky="ns")

        self.canvas2 = Canvas(self.im_frame,
                              width=self.canvas_dimension,
                              height=self.canvas_dimension,
                              background='black')
        self.canvas2.grid(row=0, column=1, sticky="ns")

        # buttons
        self.all_buttons_frame = ttk.Frame(self.primary_window)
        self.all_buttons_frame.grid(row=2, column=0, columnspan=2)
        #
        self.buttons_frame = ttk.Frame(self.all_buttons_frame)
        self.buttons_frame.grid(row=2, column=0, columnspan=2)
        #
        Button(self.buttons_frame,
               command=self.shuffle,
               image=self.random_photo,
               width="80",
               height="80").grid(row=0, column=3)
        #
        Button(self.buttons_frame,
               command=self.parent.cube.solve,
               image=self.accept_photo,
               width="80",
               height="80").grid(row=0, column=4)
        #
        Button(self.buttons_frame,
               command=self.refresh,
               image=self.refresh_photo,
               width="80",
               height="80").grid(row=0, column=6)
        #
        Button(self.buttons_frame,
               command=self.parent.cube.load,
               image=self.open_photo,
               width="80",
               height="80").grid(row=0, column=7)
        # cube move buttons
        self.move_buttons_frame = ttk.Frame(self.all_buttons_frame)
        self.move_buttons_frame.grid(row=3, column=0, columnspan=2)
        for x in range(6):
            Grid.columnconfigure(self.move_buttons_frame, x, weight=1)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("R"),
            text='R',
            font=self.main_font,
        ).grid(row=0, column=0)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("L"),
            text='L',
            font=self.main_font,
        ).grid(row=0, column=1)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("U"),
            text='U',
            font=self.main_font,
        ).grid(row=0, column=2)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("D"),
            text='D',
            font=self.main_font,
        ).grid(row=0, column=3)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("F"),
            text='F',
            font=self.main_font,
        ).grid(row=0, column=4)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("B"),
            text='B',
            font=self.main_font,
        ).grid(row=0, column=5)
        #
        # CCW buttons
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("R'"),
            text="R'",
            font=self.main_font,
        ).grid(row=1, column=0)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("L'"),
            text="L'",
            font=self.main_font,
        ).grid(row=1, column=1)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("U'"),
            text="U'",
            font=self.main_font,
        ).grid(row=1, column=2)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("D'"),
            text="D'",
            font=self.main_font,
        ).grid(row=1, column=3)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("F'"),
            text="F'",
            font=self.main_font,
        ).grid(row=1, column=4)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.move("B'"),
            text="B'",
            font=self.main_font,
        ).grid(row=1, column=5)
        # turn cube buttons
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.turn("D"),
            text="X",
            font=self.main_font,
        ).grid(row=2, column=0)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.turn("U"),
            text="X'",
            font=self.main_font,
        ).grid(row=2, column=1)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.turn("R"),
            text="Y",
            font=self.main_font,
        ).grid(row=2, column=2)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.turn("L"),
            text="Y'",
            font=self.main_font,
        ).grid(row=2, column=3)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.turn("Z"),
            text="Z",
            font=self.main_font,
        ).grid(row=2, column=4)
        #
        Button(
            self.move_buttons_frame,
            command=lambda: self.turn("Z'"),
            text="Z'",
            font=self.main_font,
        ).grid(row=2, column=5)
        # self.grid_image_frame = ttk.Frame(self.primary_window)
        # self.grid_image_frame.grid(row=2,column=3,columnspan=2)
        self.grid_canvas_size = .8 * self.canvas_dimension, .8 * self.canvas_dimension * 9 / 12
        self.grid_canvas = Canvas(self.primary_window,
                                  width=self.grid_canvas_size[0],
                                  height=self.grid_canvas_size[1],
                                  background='black')
        self.grid_canvas.grid(row=2, column=3, columnspan=2)
        # button bindings
        self.primary_window.bind("U", lambda event: self.move("U"))
        self.primary_window.bind("u", lambda event: self.move("U"))
        self.primary_window.bind("<Control-U>", lambda event: self.move("U'"))
        self.primary_window.bind("<Control-u>", lambda event: self.move("U'"))
        #
        self.primary_window.bind("D", lambda event: self.move("D"))
        self.primary_window.bind("d", lambda event: self.move("D"))
        self.primary_window.bind("<Control-D>", lambda event: self.move("D'"))
        self.primary_window.bind("<Control-d>", lambda event: self.move("D'"))
        #
        self.primary_window.bind("R", lambda event: self.move("R"))
        self.primary_window.bind("r", lambda event: self.move("R"))
        self.primary_window.bind("<Control-R>", lambda event: self.move("R'"))
        self.primary_window.bind("<Control-r>", lambda event: self.move("R'"))
        #
        self.primary_window.bind("L", lambda event: self.move("L"))
        self.primary_window.bind("l", lambda event: self.move("L"))
        self.primary_window.bind("<Control-L>", lambda event: self.move("L'"))
        self.primary_window.bind("<Control-l>", lambda event: self.move("L'"))
        #
        self.primary_window.bind("F", lambda event: self.move("F"))
        self.primary_window.bind("f", lambda event: self.move("F"))
        self.primary_window.bind("<Control-F>", lambda event: self.move("F'"))
        self.primary_window.bind("<Control-f>", lambda event: self.move("F'"))
        #
        self.primary_window.bind("B", lambda event: self.move("B"))
        self.primary_window.bind("b", lambda event: self.move("B"))
        self.primary_window.bind("<Control-B>", lambda event: self.move("B'"))
        self.primary_window.bind("<Control-b>", lambda event: self.move("B'"))
Exemplo n.º 33
0
    def mainDialog(self):

        self.basicframe = Frame(self.root)
        self.basicframe.grid()
        self.basicframe.configure(bg=bgcolor)

        self.fr = Frame(self.basicframe)
        self.fr.grid(row=0, column=0, sticky='new')  # , sticky='W')
        self.fr.configure(bg=bgcolor)

        # Grid.rowconfigure(root, 0, weight=1)
        Grid.columnconfigure(root, 0, weight=1)

        self.emptyRow(0)

        Label(self.fr, textvariable=self.labelTop,
              justify='center', bg=bgcolor, font=("Calibri", 24)
              ).grid(row=1, column=0, columnspan=3, sticky='we')

        self.emptyRow(2)

        Label(self.fr, text='STATUS:', justify='left', anchor='w',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
              ).grid(row=3, column=0, sticky='we', padx=(5, 0))

        self.statusLine = Label(self.fr, textvariable=self.statusString,
                                justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                font=("Calibri", 14, "bold")
                                ).grid(row=3, column=1, columnspan=2, sticky='we')

        self.emptyRow(4)

        # AUTO / MANUAL  self.my_var.set(1)
        self.buttonManual = Radiobutton(self.fr, text="MANUAL",
                                     variable=self.auto,
                                     value=0,
                                     width=15,
                                     justify='center',
                                     # bg=buttoncolor2,
                                     bg="moccasin",
                                     indicatoron=0)  # self.exit_root)
        self.buttonManual.grid(row=5, column=0, sticky='ew', padx=(0, 10))
        # self.buttonManual.configure(state='selected')

        self.buttonAuto = Radiobutton(self.fr, text="AUTO",
                                   variable=self.auto,
                                   value=1,
                                   width=15, justify='center',
                                   # bg=buttoncolor2,
                                   bg="moccasin",
                                   indicatoron=0)  # self.exit_root)
        self.buttonAuto.grid(row=5, column=2, sticky='ew', padx=(10, 0))

        self.emptyRow(6)

        #should be disabled if initialized already
        self.buttonInitialize = Button(self.fr, text='Initialize',
                                   justify='center', bg=buttoncolor, command=self.initialize)
        self.buttonInitialize.grid(row=7, column=0, sticky='nsew')

        self.buttonStartStop = Button(self.fr, textvariable=self.label11,
                                   command=self.startStop,
                                   bg=startstopbg[self.active],
                                   fg=startstopfg[self.active],
                                   font=("Calibri", 16, "bold"),
                                   width=10)
        self.buttonStartStop.grid(row=7, column=1, sticky='nsew')

        self.buttonPause = Button(self.fr, textvariable=self.label12,
                                   justify='center', bg=buttoncolor,
                                   state={0: 'disabled', 1: 'enabled'}[self.auto],
                                   command=self.pause)
        self.buttonPause.grid(row=7, column=2, sticky='nsew')

        self.emptyRow(8)

        # put Labels here

        Label(self.fr, textvariable=self.label31, justify='center',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 10)
              ).grid(row=8, column=0, sticky='we')
        Label(self.fr, textvariable=self.label32, justify='center',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 10)
              ).grid(row=8, column=1, sticky='we')
        Label(self.fr, textvariable=self.label33, justify='center',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 10)
              ).grid(row=8, column=2, sticky='we')

        # input boxes: step start stop (mm)
        self.lowEntry = Entry(self.fr, width=20, bd=3, justify='right',
                              bg=inputbox, fg=statuscolor)
        self.lowEntry.grid(row=9, column=0, sticky='we')  # , columnspan=2)
        # SET DEFAULT LOW
        # self.lowEntry.delete(0,END)
        # self.lowEntry.insert(0, MINPOS)

        self.hiEntry = Entry(self.fr, width=20, bd=3, justify='right',
                             bg=inputbox, fg=statuscolor)
        self.hiEntry.grid(row=9, column=1, sticky='we')  # , columnspan=2)
        # SET DEFAULT HIGH
        # self.hiEntry.delete(0,END)
        # self.hiEntry.insert(0, MAXPOS)

        self.stepEntry = Entry(self.fr, width=20, bd=3, justify='right',
                               bg=inputbox, fg=statuscolor)
        self.stepEntry.grid(row=9, column=2, sticky='we')  # , columnspan=2)

        # put buttons for  GOTO and MOVE
        self.butGotoLow = Button(self.fr, text="Go To Low",
                                 justify='center', bg=buttoncolor, command=self.gotoLow)
        self.butGotoLow.grid(row=10, column=0, sticky='we')

        self.butGotoHi = Button(self.fr, text="Go To High",
                                justify='center', bg=buttoncolor, command=self.gotoHi)
        self.butGotoHi.grid(row=10, column=1, sticky='we')

        self.butMoveStep = Button(self.fr, text="Move a Step",
                                  justify='center', bg=buttoncolor, command=self.moveStep)
        self.butMoveStep.grid(row=10, column=2, sticky='we')

        self.emptyRow(11)

        Label(self.fr, text='EXTERNAL SENSORS', justify='left',
              anchor='w', bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
              ).grid(row=12, column=0, columnspan=3, sticky='we', padx=(5, 0))

        # function buttons


        # RIadok 13-16: Externals
        # Interferometer
        buttonIfm = Button(self.fr, text="Read IFM", width=15, justify='center',
                        bg=buttoncolor, command=self.getIfm)  # self.exit_root)
        buttonIfm.grid(row=13, column=0, sticky='we')

        self.labelIfmStatus = Label(self.fr, textvariable=self.ifmStatus,
                                  justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                  font=("Calibri", 12))
        self.labelIfmStatus.grid(row=13, column=1, columnspan=2,
                               sticky='we', padx=(15, 0))
        self.labelIfmStatus.bind('<Button-1>', self.resetIfmStatus)

        # Digital level (Leica /Trimble)
        buttonLevel = Button(self.fr, text="Read Level", width=15, justify='center',
                        bg=buttoncolor, command=self.getLevel)  # self.exit_root)
        buttonLevel.grid(row=14, column=0, sticky='we')

        self.labelLevelStatus = Label(self.fr, textvariable=self.levelStatus,
                                  justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                  font=("Calibri", 12))
        self.labelLevelStatus.grid(row=14, column=1, columnspan=2,
                               sticky='we', padx=(15, 0))
        self.labelLevelStatus.bind('<Button-1>', self.resetLevelStatus)

        # Nivel - inclinometer
        buttonNivel = Button(self.fr, text="Read Nivel", width=15, justify='center',
                        bg=buttoncolor, command=self.getNivel)  # self.exit_root)
        buttonNivel.grid(row=15, column=0, sticky='we')

        self.labelNivelStatus = Label(self.fr, textvariable=self.nivelStatus,
                                  justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                  font=("Calibri", 12))
        self.labelNivelStatus.grid(row=15, column=1, columnspan=2,
                               sticky='we', padx=(15, 0))
        self.labelNivelStatus.bind('<Button-1>', self.resetNivelStatus)

        # Thermometer line
        buttonThermo = Button(self.fr, text="Read Thermo", width=15, justify='center',
                        bg=buttoncolor, command=self.getThermo)  # self.exit_root)
        buttonThermo.grid(row=16, column=0, sticky='we')

        self.labelThermoStatus = Label(self.fr, textvariable=self.thermoStatus,
                                  justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                  font=("Calibri", 12))
        self.labelThermoStatus.grid(row=16, column=1, columnspan=2,
                               sticky='we', padx=(15, 0))
        self.labelThermoStatus.bind('<Button-1>', self.resetThermoStatus)

        self.emptyRow(17)

        Label(self.fr, text='OBSERVER:', anchor='w', justify='left',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
              ).grid(row=19, column=0, sticky='we', padx=(5, 0))
        self.entryObserver = Entry(self.fr, textvariable=self.observer,
                                   bg=inputbox, fg=statuscolor, font=("Calibri", 12),
                                   justify='left')
        self.entryObserver.grid(row=19, column=1, columnspan=2, sticky='we')

        # row 18> empty (or test connection)
        self.emptyRow(20)

        if ADMIN_MODE:
            # port, message, checksum_type?, resulting checksum?, submit, response
            self.portEntry = Entry(self.fr, width=20, bd=3, justify='left',
                                   bg=inputbox, fg=statuscolor)
            self.portEntry.grid(row=21, column=0, sticky='we')
            Label(self.fr, text='PORT', anchor='w', justify='left',
                  bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
                  ).grid(row=22, column=0, sticky='we', padx=(5, 0))

            self.messageEntry = Entry(self.fr, width=20, bd=3, justify='left',
                                   bg=inputbox, fg=statuscolor)
            self.messageEntry.grid(row=21, column=1, sticky='we')
            Label(self.fr, text='MESSAGE', anchor='w', justify='left',
                  bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
                  ).grid(row=22, column=1, sticky='we', padx=(5, 0))

            self.portChecksumType = Entry(self.fr, width=20, bd=3, justify='left',
                                   bg=inputbox, fg=statuscolor)
            self.portChecksumType.grid(row=21, column=2, sticky = 'we')
            Label(self.fr, text='CHKSUM TYPE', anchor='w', justify='left',
                        bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
                        ).grid(row=22, column=2, sticky='we', padx=(5, 0))


            self.chksumLabel = Label(self.fr, textvariable=self.chksumText, anchor='w',
                                bg=bgcolor, fg=statuscolor, font=("Calibri", 9))
            self.chksumLabel.grid(row=23, column=2)

            buttonSubmit = Button(self.fr, text="SUBMIT", width=15, justify='center',
                             bg="black", fg="yellow", command=self.submit,
                             font=("Calibri", 14, "bold"))
            buttonSubmit.grid(row=23, column=0)


            self.responseLabel = Label(self.fr, textvariable=self.responseText, anchor='w',
                                bg=bgcolor, fg=statuscolor, font=("Calibri", 9))
            self.responseLabel.grid(row=23, column=1)

            self.emptyRow(24)


        lastLine = 21 if not ADMIN_MODE else 25

        self.timeLabel = Label(self.fr, textvariable=self.timestring,
                               anchor='w', bg=bgcolor, fg=statuscolor,
                               font=("Calibri", 9))
        self.timeLabel.grid(row=lastLine, column=0)

        self.connLabel = Label(self.fr, textvariable=self.connstring,
                               anchor='w', bg=bgcolor, fg=statuscolor,
                               font=("Calibri", 9))
        self.connLabel.grid(row=lastLine, column=1)

        butexit = Button(self.fr, text="EXIT", width=15, justify='center',
                         bg="black", fg="yellow", command=self.close,
                         font=("Calibri", 14, "bold"))
        butexit.grid(row=lastLine, column=2)
Exemplo n.º 34
0
    # current image
    CURRENT = 0

    # Creating root window
    root = tk.Tk()
    root.wm_minsize(450, 450)
    root.title('IMAGE VIEWER')

    # initial image
    img = Image.open('Images/'+images[CURRENT])
    img = ImageTk.PhotoImage(resize(img))
    # image label
    IMAGE_LABEL = tk.Label(root, image=img)
    IMAGE_LABEL.grid(row=0, column=1, sticky=tk.E+tk.W+tk.N+tk.S)
    Grid.rowconfigure(root, 0, weight=1)
    Grid.columnconfigure(root, 1, weight=1)

    # Back button
    img_back = Image.open('Back_forward_button/back.jpg')
    img_back.thumbnail((100, 50))
    back_img = ImageTk.PhotoImage(img_back)
    BACK = tk.Button(root, image=back_img, command=back_click)
    BACK.grid(row=0, column=0, sticky=tk.W)

    # Forward Button
    img_forward = Image.open('Back_forward_button/forward.jpg')
    img_forward.thumbnail((100, 50))
    forward_img = ImageTk.PhotoImage(img_forward)
    FORWARD = tk.Button(root, image=forward_img, command=forward_click)
    FORWARD.grid(row=0, column=2, sticky=tk.E)
    def __init__(self, master):
        # instantiate scan_log object with no input or output files selected
        tk.Frame.__init__(self)
        self.scanner = ScanLog(None, None, log_database='log_messages.json')

        self.master = master
        # set window settings
        master.title("Cradlepoint Log Analyzer")
        master.geometry('1000x900')
        # Assemble path to icon
        dirname = os.path.dirname(__file__)
        icon = os.path.join(dirname, './resources/cradlepoint_icon.ico')
        master.iconbitmap(icon)
        master.iconbitmap(icon)
        master.option_add('*tearOff', False)

        # configure grid
        Grid.columnconfigure(master, 0, weight=0, minsize=17)
        Grid.columnconfigure(master, 1, weight=1)
        Grid.columnconfigure(master, 2, weight=0, minsize=20)
        Grid.columnconfigure(master, 3, weight=1)
        Grid.rowconfigure(master, 1, weight=1)

        # create log scrollboxes & labels
        self.log_text = Label(master, text="Cradlepoint Log")
        self.log_text.grid(column=1, row=0, sticky=W)

        self.log_scrolledtext = ScrolledText.ScrolledText(master,
                                                          font='Segoe 11',
                                                          wrap='word')
        self.log_scrolledtext.grid(column=1, row=1, sticky=N + S + E + W)

        self.log_linenumbers = TextLineNumbers(self.log_scrolledtext, width=30)
        self.log_linenumbers.attach(self.log_scrolledtext)
        self.log_linenumbers.grid(column=0, row=1, sticky=N + W + S)

        # create scan results scrollboxes & labels
        self.scan_text = Label(master, text="Scan Results")
        self.scan_text.grid(column=3, row=0, sticky=W)

        self.scan_scrolledtext = ScrolledText.ScrolledText(master,
                                                           font='Segoe 11',
                                                           wrap='word')
        self.scan_scrolledtext.grid(column=3, row=1, sticky=N + S + W + E)

        self.scan_linenumbers = TextLineNumbers(self.scan_scrolledtext,
                                                width=30)
        self.scan_linenumbers.attach(self.scan_scrolledtext)
        self.scan_linenumbers.grid(column=2, row=1, sticky=N + W + S)

        # create menus for the window
        self.menu = Menu(master)
        master.config(menu=self.menu)

        # file menu
        self.filemenu = Menu(self.menu)
        self.menu.add_cascade(label="File", menu=self.filemenu)
        self.filemenu.add_command(label="Open...",
                                  command=self.select_file_command)
        self.filemenu.add_command(label="Save scan output...",
                                  command=self.save_file_command)
        self.filemenu.add_separator()
        self.filemenu.add_command(label="Scan Log",
                                  command=self.scan_textbox_command)
        self.filemenu.add_separator()
        self.filemenu.add_command(label="Exit", command=self.exit_command)

        # categories menu
        self.categories_menu = Menu(self.menu)
        self.menu.add_cascade(label="Categories", menu=self.categories_menu)

        self.connectivity_checkbox = BooleanVar()
        self.connectivity_checkbox.set(True)
        self.categories_menu.add_checkbutton(
            label="Connectivity+Modem",
            onvalue=True,
            offvalue=False,
            variable=self.connectivity_checkbox,
            command=self.update_scan)

        self.ipsec_checkbox = BooleanVar()
        self.ipsec_checkbox.set(True)
        self.categories_menu.add_checkbutton(label="IPSec",
                                             onvalue=True,
                                             offvalue=False,
                                             variable=self.ipsec_checkbox,
                                             command=self.update_scan)

        self.routing_protocols_checkbox = BooleanVar()
        self.routing_protocols_checkbox.set(True)
        self.categories_menu.add_checkbutton(
            label="Routing Protocols",
            onvalue=True,
            offvalue=False,
            variable=self.routing_protocols_checkbox,
            command=self.update_scan)

        self.ncp_checkbox = BooleanVar()
        self.ncp_checkbox.set(True)
        self.categories_menu.add_checkbutton(label="NCP",
                                             onvalue=True,
                                             offvalue=False,
                                             variable=self.ncp_checkbox,
                                             command=self.update_scan)

        self.ncm_checkbox = BooleanVar()
        self.ncm_checkbox.set(True)
        self.categories_menu.add_checkbutton(label="NCM",
                                             onvalue=True,
                                             offvalue=False,
                                             variable=self.ncm_checkbox,
                                             command=self.update_scan)

        # help menu
        self.helpmenu = Menu(self.menu)
        self.menu.add_cascade(label="Help", menu=self.helpmenu)
        self.helpmenu.add_command(label="About...", command=self.about_command)

        self.log_scrolledtext.bind('<f>', self.find_text)
Exemplo n.º 36
0
    def __init__(self, master):
        self.master = master
        sel_col = 0
        hold_col = 1

        lbl_row = 0
        lst_row = 1
        btn_row = 2
        save_row = 3

        self.edited = False

        scale_factor = 0.5
        window_width = int(root.winfo_screenwidth() * scale_factor)
        window_height = int(root.winfo_screenheight() * scale_factor)

        self.master.geometry(f"{window_width}x{window_height}")

        frame = Frame(master)

        Grid.columnconfigure(master, sel_col, weight=1)
        Grid.columnconfigure(master, hold_col, weight=1)

        Grid.rowconfigure(master, lst_row, weight=1)

        frame.grid()

        self.full_listbox = Listbox(master, selectmode=EXTENDED, width=20)
        scrollbar = Scrollbar(self.full_listbox, orient=VERTICAL)
        self.full_listbox.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.full_listbox)
        scrollbar.pack(side=RIGHT, fill=Y)
        self.full_listbox.grid(row=lst_row,
                               column=sel_col,
                               padx=(20, 20),
                               pady=(5, 10),
                               sticky='news')

        self.holdout_listbox = Listbox(master, selectmode=EXTENDED, width=20)
        scrollbar = Scrollbar(self.holdout_listbox, orient=VERTICAL)
        self.holdout_listbox.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.holdout_listbox)
        scrollbar.pack(side=RIGHT, fill=Y)
        self.holdout_listbox.grid(row=lst_row,
                                  column=hold_col,
                                  padx=(20, 20),
                                  pady=(5, 10),
                                  sticky='news')

        self.selected_param_label = Label(master, text="Selected Parameters")
        self.selected_param_label.grid(row=lbl_row, column=sel_col)

        self.holdout_param_label = Label(master, text="Holdout Parameters")
        self.holdout_param_label.grid(row=lbl_row, column=hold_col)

        self.selected_to_holdout_button = Button(master,
                                                 text="->",
                                                 command=self.move_to_holdout)
        self.selected_to_holdout_button.grid(row=btn_row,
                                             column=sel_col,
                                             padx=(40, 40),
                                             sticky='ew')

        self.holdout_to_selected_button = Button(master,
                                                 text="<-",
                                                 command=self.move_to_selected)
        self.holdout_to_selected_button.grid(row=btn_row,
                                             column=hold_col,
                                             padx=(40, 40),
                                             pady=(5, 10),
                                             sticky='ew')

        self.save_button = Button(master, text="Save", command=self.save_lists)
        self.save_button.grid(row=save_row, column=sel_col, pady=(5, 10))

        self.reset_button = Button(master,
                                   text="Reset",
                                   command=self.config_listboxes)
        self.reset_button.grid(row=save_row, column=hold_col)

        self.dataset_dir = ""
        self.params_path = ""
    def __init__(self, master):
        super().__init__(master, relief=tk.RAISED)
        # self.pack() adds this instance to the window (master)
        Grid.rowconfigure(master, 0, weight=1)
        Grid.columnconfigure(master, 0, weight=1)
        self.grid(column=0, row=0, sticky="N" + 'S' + 'E' + 'W')
        grid = Frame(self)
        grid.grid(sticky="N" + 'S' + 'E' + 'W', column=0, row=5, columnspan=2)
        Grid.columnconfigure(master, 0, weight=1)
        Grid.rowconfigure(master, 5, weight=1)
        #self.pack()
        # Start an Equation instance and set it to an empty string
        self.equation = Equation()
        self.equation_output = tk.StringVar("")

        # Add the title to the window
        master.title("Calculator")

        # Add the equation window that shows what is being entered
        self.equation_window = tk.Label(textvariable=self.equation_output,
                                        fg="black",
                                        bg="light grey",
                                        height=3)
        #self.equation_window.pack(side=tk.TOP)
        self.equation_window.grid(column=0,
                                  row=0,
                                  columnspan=4,
                                  sticky="N" + 'S' + 'E' + 'W')

        # Add all the number buttons
        self.one_button = tk.Button(
            text="1",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "1"),
                self.equation_output.set(self.equation.equation_output())
            ])
        #self.one_button.pack(side=tk.LEFT)
        self.one_button.grid(column=0, row=2, sticky="N" + 'S' + 'E' + 'W')
        self.two_button = tk.Button(
            text="2",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "2"),
                self.equation_output.set(self.equation.equation_output())
            ])
        #self.two_button.pack(side=tk.LEFT)
        self.two_button.grid(column=1, row=2, sticky="N" + 'S' + 'E' + 'W')
        self.three_button = tk.Button(
            text="3",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "3"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.three_button.grid(column=2, row=2, sticky="N" + 'S' + 'E' + 'W')

        self.four_button = tk.Button(
            text="4",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "4"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.four_button.grid(column=0, row=3, sticky="N" + 'S' + 'E' + 'W')
        self.five_button = tk.Button(
            text="5",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "5"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.five_button.grid(column=1, row=3, sticky="N" + 'S' + 'E' + 'W')

        self.six_button = tk.Button(
            text="6",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "6"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.six_button.grid(column=2, row=3, sticky="N" + 'S' + 'E' + 'W')
        self.seven_button = tk.Button(
            text="7",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "7"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.seven_button.grid(column=0, row=4, sticky="N" + 'S' + 'E' + 'W')

        self.eight_button = tk.Button(
            text="8",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "8"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.eight_button.grid(column=1, row=4, sticky="N" + 'S' + 'E' + 'W')
        self.nine_button = tk.Button(
            text="9",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "9"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.nine_button.grid(column=2, row=4, sticky="N" + 'S' + 'E' + 'W')

        self.zero_button = tk.Button(
            text="0",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.numeric_input(self.equation, "0"),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.zero_button.grid(column=0, row=5, sticky="N" + 'S' + 'E' + 'W')

        # Add all the expression buttons
        self.addition_button = tk.Button(
            text="+",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.expression_input(self.equation, '+'),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.addition_button.grid(column=3,
                                  row=2,
                                  sticky="N" + 'S' + 'E' + 'W')

        self.subtraction_button = tk.Button(
            text="-",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.expression_input(self.equation, '-'),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.subtraction_button.grid(column=3,
                                     row=3,
                                     sticky="N" + 'S' + 'E' + 'W')

        self.multiplication_button = tk.Button(
            text="x",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.expression_input(self.equation, '*'),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.multiplication_button.grid(column=3,
                                        row=4,
                                        sticky="N" + 'S' + 'E' + 'W')

        self.division_button = tk.Button(
            text="/",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.expression_input(self.equation, '/'),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.division_button.grid(column=3,
                                  row=1,
                                  sticky="N" + 'S' + 'E' + 'W')

        self.decimal_button = tk.Button(
            text=".",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.decimal_input(self.equation, '.'),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.decimal_button.grid(column=1, row=5, sticky="N" + 'S' + 'E' + 'W')

        self.open_paren_button = tk.Button(
            text="(",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.open_paren_input(self.equation, '('),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.open_paren_button.grid(column=0,
                                    row=1,
                                    sticky="N" + 'S' + 'E' + 'W')
        self.closed_paren_button = tk.Button(
            text=")",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.closed_paren_input(self.equation, ')'),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.closed_paren_button.grid(column=1,
                                      row=1,
                                      sticky="N" + 'S' + 'E' + 'W')

        self.exponent_button = tk.Button(
            # TODO add an exponent image instead of text="**"
            text="**",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.expression_input(self.equation, '**'),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.exponent_button.grid(column=2,
                                  row=1,
                                  sticky="N" + 'S' + 'E' + 'W')
        self.equals_button = tk.Button(
            # TODO Add functionality to equals button, ex: answer is displayed as equation output
            text="=",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.equals_input(self.equation, '='),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.equals_button.grid(column=2, row=5, sticky="N" + 'S' + 'E' + 'W')
        self.clear_button = tk.Button(
            # TODO Add functionality to equals button, ex: answer is displayed as equation output
            text="Clear",
            bg="grey",
            fg="black",
            width=10,
            height=3,
            command=lambda: [
                Equation.clear_input(self.equation),
                self.equation_output.set(self.equation.equation_output())
            ])
        self.clear_button.grid(column=3, row=5, sticky="N" + 'S' + 'E' + 'W')

        for x in range(4):
            Grid.columnconfigure(master, x, weight=1)
        for y in range(6):
            Grid.rowconfigure(master, y, weight=1)
Exemplo n.º 38
0
    def mainDialog(self):

        self.basicframe = Frame(self.root)
        self.basicframe.grid()
        self.basicframe.configure(bg=bgcolor)

        self.fr = Frame(self.basicframe)
        self.fr.grid(row=0, column=0, sticky='new')  # , sticky='W')
        self.fr.configure(bg=bgcolor)

        # Grid.rowconfigure(root, 0, weight=1)
        Grid.columnconfigure(root, 0, weight=1)

        self.emptyRow(0)

        Label(self.fr, textvariable=self.labelTop,
              justify='center', bg=bgcolor, font=("Calibri", 24)
              ).grid(row=1, column=0, columnspan=3, sticky='we')

        self.emptyRow(2)

        Label(self.fr, text='STATUS:', justify='left', anchor='w',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
              ).grid(row=3, column=0, sticky='we', padx=(5, 0))

        self.statusLine = Label(self.fr, textvariable=self.statusString,
                                justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                font=("Calibri", 14, "bold")
                                ).grid(row=3, column=1, columnspan=2, sticky='we')

        self.emptyRow(4)

        self.butStartStop = Button(self.fr, textvariable=self.label10,
                                   command=self.startStop,
                                   bg=startstopbg[self.active],
                                   fg=startstopfg[self.active],
                                   font=("Calibri", 16, "bold"),
                                   width=10)
        self.butStartStop.grid(row=5, column=1, sticky='nsew')

        # AUTO / MANUAL  self.my_var.set(1)
        self.butManual = Radiobutton(self.fr, text="MANUAL",
                                     variable=self.auto,
                                     value=0,
                                     width=15,
                                     justify='center',
                                     # bg=buttoncolor2,
                                     bg="moccasin",
                                     indicatoron=0)  # self.exit_root)
        self.butManual.grid(row=5, column=0, sticky='ew', padx=(0, 10))
        # self.butManual.configure(state='selected')

        self.butAuto = Radiobutton(self.fr, text="AUTO",
                                   variable=self.auto,
                                   value=1,
                                   width=15, justify='center',
                                   # bg=buttoncolor2,
                                   bg="moccasin",
                                   indicatoron=0)  # self.exit_root)
        self.butAuto.grid(row=5, column=2, sticky='ew', padx=(10, 0))

        self.emptyRow(6)
        self.emptyRow(7)

        # put Labels here

        Label(self.fr, textvariable=self.label31, justify='center',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 10)
              ).grid(row=8, column=0, sticky='we')
        Label(self.fr, textvariable=self.label32, justify='center',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 10)
              ).grid(row=8, column=1, sticky='we')
        Label(self.fr, textvariable=self.label33, justify='center',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 10)
              ).grid(row=8, column=2, sticky='we')

        # input boxes: step start stop (mm)
        self.lowEntry = Entry(self.fr, width=20, bd=3, justify='right',
                              bg=inputbox, fg=statuscolor)
        self.lowEntry.grid(row=9, column=0, sticky='we')  # , columnspan=2)
        # SET DEFAULT LOW
        # self.lowEntry.delete(0,END)
        # self.lowEntry.insert(0, MINPOS)

        self.hiEntry = Entry(self.fr, width=20, bd=3, justify='right',
                             bg=inputbox, fg=statuscolor)
        self.hiEntry.grid(row=9, column=1, sticky='we')  # , columnspan=2)
        # SET DEFAULT HIGH
        # self.hiEntry.delete(0,END)
        # self.hiEntry.insert(0, MAXPOS)

        self.stepEntry = Entry(self.fr, width=20, bd=3, justify='right',
                               bg=inputbox, fg=statuscolor)
        self.stepEntry.grid(row=9, column=2, sticky='we')  # , columnspan=2)

        # put buttons for  GOTO and MOVE
        self.butGotoLow = Button(self.fr, text="Go To Low",
                                 justify='center', bg=buttoncolor, command=self.gotoLow)
        self.butGotoLow.grid(row=10, column=0, sticky='we')

        self.butGotoHi = Button(self.fr, text="Go To High",
                                justify='center', bg=buttoncolor, command=self.gotoHi)
        self.butGotoHi.grid(row=10, column=1, sticky='we')

        self.butMoveStep = Button(self.fr, text="Move a Step",
                                  justify='center', bg=buttoncolor, command=self.moveStep)
        self.butMoveStep.grid(row=10, column=2, sticky='we')

        self.emptyRow(11)

        Label(self.fr, text='EXTERNAL SENSORS', justify='left',
              anchor='w', bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
              ).grid(row=12, column=0, columnspan=3, sticky='we', padx=(5, 0))

        # function buttons


        # RIadok 12: Externals
        butIFM = Button(self.fr, text="Read IFM", width=15, justify='center',
                        bg=buttoncolor, command=self.getIfm)  # self.exit_root)
        butIFM.grid(row=13, column=0, sticky='we')

        self.labIfmStatus = Label(self.fr, textvariable=self.ifmStatus,
                                  justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                  font=("Calibri", 12))
        self.labIfmStatus.grid(row=13, column=1, columnspan=2,
                               sticky='we', padx=(15, 0))
        self.labIfmStatus.bind('<Button-1>', self.resetIfmStatus)

        butLVL = Button(self.fr, text="Read level", width=15, justify='center',
                        bg=buttoncolor, command=self.getLevel)  # self.exit_root)
        butLVL.grid(row=14, column=0, sticky='we')

        self.labLvlStatus = Label(self.fr, textvariable=self.lvlStatus,
                                  justify='left', anchor='w', bg=bgcolor, fg=statuscolor,
                                  font=("Calibri", 12))
        self.labLvlStatus.grid(row=14, column=1, columnspan=2,
                               sticky='we', padx=(15, 0))
        self.labLvlStatus.bind('<Button-1>', self.resetLvlStatus)

        self.emptyRow(15)

        Label(self.fr, text='OBSERVER:', anchor='w', justify='left',
              bg=bgcolor, fg=statuscolor, font=("Calibri", 12)
              ).grid(row=16, column=0, sticky='we', padx=(5, 0))
        self.entryObserver = Entry(self.fr, textvariable=self.observer,
                                   bg=inputbox, fg=statuscolor, font=("Calibri", 12),
                                   justify='left')
        self.entryObserver.grid(row=16, column=1, columnspan=2, sticky='we')

        # row 18> empty (or test connection)
        self.emptyRow(18)
        self.timeLabel = Label(self.fr, textvariable=self.timestring,
                               anchor='w', bg=bgcolor, fg=statuscolor,
                               font=("Calibri", 9))
        self.timeLabel.grid(row=19, column=0)

        self.connLabel = Label(self.fr, textvariable=self.connstring,
                               anchor='w', bg=bgcolor, fg=statuscolor,
                               font=("Calibri", 9))
        self.connLabel.grid(row=19, column=1)

        butexit = Button(self.fr, text="EXIT", width=15, justify='center',
                         bg="black", fg="yellow", command=self.close,
                         font=("Calibri", 14, "bold"))
        butexit.grid(row=19, column=2)