예제 #1
0
 def show_params(self, event):
     self.param_view.destroy()
     if (self.params.get(self.tree.selection()[0], None) != None):
         self.param_view = Labelframe(self)
         self.load_params(self.param_view, self.tree.selection()[0])
         self.param_view.config(text='Test Parameters')
         self.param_view.pack(fill=BOTH, expand=True)
예제 #2
0
파일: mainBody.py 프로젝트: Dickzilla/bikoy
 def __init__(self, parent, name='Test Program'):
     Frame.__init__(self, parent.master)
     self.parent = parent
     self.name = name
     self.window = Panedwindow(self, orient=HORIZONTAL)
     self.lframe = Labelframe(self)
     self.lframe = TestprogramPane(self)
     self.rframe = Labelframe(self)
     self.rframe = PinsPane(self)
예제 #3
0
 def show_pins(self, event):
     self.pins_view.destroy()
     self.pins_view = Labelframe(self)
     pinref = self.param_tree.item(self.param_tree.selection()[0],
                                   "value")[0]
     self.fetch_pins(self.tp.pintree, pinref)
     if (self.pins.get(pinref, None) != None):
         self.pins_view = Labelframe(self)
         self.load_pins(self.pins_view, pinref)
         self.pins_view.config(text='Pin Parameters')
         self.pins_view.pack(fill=BOTH, expand=True)
예제 #4
0
    def __init__(self, window, **kwargs):
        Labelframe.__init__(self, window, **kwargs)
        self.name_of_applicant_n_lab = Label(self, text="Wnioskodawcy (m)")
        self.name_of_applicant_n_lab.grid(row=0, column=0, padx=5, pady=5, sticky='e')
        self.name_of_applicant_n = Entry(self, width = 40)
        self.name_of_applicant_n.grid(row=0, column=1, columnspan=3, padx=5, pady=5, sticky='w')

        self.name_of_applicant_g_lab = Label(self, text="Wnioskodawcy (d)")
        self.name_of_applicant_g_lab.grid(row=1, column=0, padx=5, pady=5, sticky='e')
        self.name_of_applicant_g = Entry(self, width = 40)
        self.name_of_applicant_g.grid(row=1, column=1, columnspan=3, padx=5, pady=5, sticky='w')

        self.city_lab = Label(self, text="Miejscowość")
        self.city_lab.grid(row=3, column=0, padx=5, pady=5, sticky='e')
        self.city = Entry(self, width=20)
        self.city.grid(row=3, column=1, columnspan=2, padx=5, pady=5, sticky='w')

        self.zip_code_lab = Label(self, text="Kod")
        self.zip_code_lab.grid(row=3, column=2, padx=5, pady=5, sticky='e')
        self.zip_code = Entry(self, width=7)
        self.zip_code.grid(row=3, column=3, padx=5, pady=5, sticky='w')

        self.address_lab = Label(self,text="Adres")
        self.address_lab.grid(row=4, column=0, padx=5, pady=5, sticky='e')
        self.address = Entry(self)
        self.address.grid(row=4, column=1, columnspan=2, padx=5, pady=5, sticky='w')

        self.same = Button(self, text="Adres jak wyżej")
        self.same.grid(row=4, column=2, columnspan=2)

        self.application_subject_lab = Label(self, text="           Wniosek o")
        self.application_subject_lab.grid(row=6, column=0, padx=5, pady=5, sticky='e')
        self.application_subject = Combobox(self, width=40, values=application)
        self.application_subject.grid(row=6, column=1, columnspan=3, padx=5, pady=5)
        self.application_subject.bind('<<ComboboxSelected>>', self.choosed_subject)
        
        self.application_reason_lab = Label(self, text="Z uwagi na")
        self.application_reason_lab.grid(row=7, column=0, padx=5, pady=5, sticky='e')
        self.application_reason = Combobox(self, width=40, postcommand=self.get_reason, exportselection=False)
        self.application_reason.bind('<<ComboboxSelected>>', self.clear_all_selection)
        self.application_reason.grid(row=7, column=1, columnspan=3, padx=5, pady=5)
        self.application_reason2_lab = Label(self, text="Z uwagi na")
        self.application_reason2_lab.grid(row=8, column=0, padx=5, pady=5, sticky='e')
        self.application_reason2 = Combobox(self, width=40, values=reasons)
        self.application_reason2.bind('<<ComboboxSelected>>', self.clear_all_selection)
        self.application_reason2.grid(row=8, column=1, columnspan=3, padx=5, pady=5)

        self.timespan_lab = Label(self, text="Na okres")
        self.timespan_lab.grid(row=9, column=0, padx=5, pady=5, sticky='e')
        self.timespan = Combobox(self, values=timespan)
        self.timespan.bind('<<ComboboxSelected>>', self.clear_all_selection)
        self.timespan.grid(row=9, column=1, pady=5, padx=5, sticky='w')
        self.timespan_ind = Entry(self, width=18)
        self.timespan_ind.grid(row=9, column=2, columnspan=2, padx=5, pady=5, sticky='w')
예제 #5
0
파일: main.py 프로젝트: f8122dac/prsim
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.root = self.winfo_toplevel()
        self.root.option_add("*Font", "serif 10 bold")
        self.root.title(" ".join((APPNAME, VERSION, "| Main")))
        self.root.resizable(0,0)
        self.root.bind('<Key>', self.__keys) 

        # Menu
        menubar = Menu(self.root)
        self.windowsmenu = Menu(menubar, tearoff=0)
        self.windowsmenu.add_command(label="[ ] Report window", command=self.__toggle_report)
        self.windowsmenu.add_command(label="Plot current model", command=self.__plot)
        self.windowsmenu.add_separator()
        self.windowsmenu.add_command(label="Quit", command=self.destroy)
        menubar.add_cascade(label="Windows", menu=self.windowsmenu)
        settingsmenu = Menu(menubar, tearoff=0)
        settingsmenu.add_command(label="Spectrum range")
        settingsmenu.add_command(label="Color scheme")
        menubar.add_cascade(label="Settings", menu=settingsmenu)
        helpmenu = Menu(menubar, tearoff=0)
        helpmenu.add_command(label="Help", command=self.__help)
        helpmenu.add_separator()
        helpmenu.add_command(label="About", command=self.__about)
        menubar.add_cascade(label="Help", menu=helpmenu)
        self.root.config(menu=menubar)
        # disabled menu items
        settingsmenu.entryconfig(0, state='disabled')
        settingsmenu.entryconfig(1, state='disabled')
        helpmenu.entryconfig(0, state='disabled')

        # Scale
        ctrls = Labelframe(self, text='Control', relief='ridge')
        self.e = Scale(ctrls, from_=E_MIN, to=E_MAX, label='Links',
                bd=1, width=7, length=150, orient='horizontal')
        self.d = Scale(ctrls, from_=D_MIN, to=D_MAX, label='Pages',
                bd=1, width=7, length=150, orient='horizontal')
        self.e.set(E)
        self.d.set(D)
        self.e.config(command=self.__refresh)
        self.d.config(command=self.__refresh)
        self.e.pack(side='left')
        self.d.pack(side='right')
        self.r_win = False
        ctrls.pack(side='top', anchor='e', padx=7, pady=5)

        # initialize model
        self.generate_model()
        self.c = GraphViewer(self, D, self.edge_counts, self.pagerank)
        self.c.pack()

        # open windows
        self.__toggle_report()
예제 #6
0
    def init_ui(self):
        self.frame = Frame(self.master)
        self.frame.pack(fill=X, padx=20, pady=20)
        self.frame_proofs = Labelframe(self.master, text='Proofs')
        self.frame_proofs.pack(side=TOP, fill=BOTH, expand=True, padx=20)
        self.frame_proofs_footer = Frame(self.frame_proofs)
        self.frame_proofs_footer.pack(side=BOTTOM, anchor=E)
        self.frame_footer = Frame(self.master)
        self.frame_footer.pack(side=BOTTOM)

        self.entry_name_text = StringVar()
        self.entry_description_text = StringVar()

        row = 1
        first_column_width = 15
        second_column_width = 40

        lbl_name = Label(self.frame, text="Name", width=first_column_width)
        lbl_name.grid(row=row, column=0, padx=10)

        self.entry_name = Entry(self.frame,
                                text=self.entry_name_text,
                                width=second_column_width)
        self.entry_name.grid(row=row, column=1)

        row += 1
        lbl_description = Label(self.frame,
                                text="Description",
                                width=first_column_width)
        lbl_description.grid(row=row, column=0, padx=10)

        self.entry_description = Entry(self.frame,
                                       text=self.entry_description_text,
                                       width=second_column_width)
        self.entry_description.grid(row=row, column=1)

        bttn_add_more_proof = Button(self.frame_proofs_footer,
                                     text="AddProof",
                                     command=self.add_more_proof)
        bttn_add_more_proof.pack(padx=5, pady=5)

        if self.finding:
            bttn_create_finding_text = "Update"
        else:
            bttn_create_finding_text = "Create"

        bttn_create_finding = Button(self.frame_footer,
                                     text=bttn_create_finding_text,
                                     command=self.commit_incidence)
        bttn_create_finding.pack(side=BOTTOM, padx=5, pady=5)
예제 #7
0
def GUIwindow_data():

    global arm
    window = tkinter.Tk()
    window.title("Patient's data")

    #-----Patient data
    patient_data = Labelframe(window, borderwidth=1, text='Patient Data')
    patient_data.grid(row=0, column=0, sticky='NW')

    # Patient name
    pat_namelbl = tkinter.Label(patient_data, text="Name")
    pat_namelbl.grid(sticky='NW')
    var_name = tkinter.StringVar()
    patient_name = tkinter.Entry(patient_data, textvariable=var_name)
    patient_name.grid(sticky='NW')

    # Patient age
    pat_agelbl = tkinter.Label(patient_data, text="Age")
    pat_agelbl.grid(sticky='W')
    var_age = tkinter.StringVar()
    patient_age = tkinter.Entry(patient_data, textvariable=var_age)
    patient_age.grid(sticky='W')

    #Radiobutton for left or right arm
    arm = tkinter.IntVar()
    armlbl = tkinter.Label(patient_data, text="Which arm is being studied ?")
    armlbl.grid(sticky='W')
    tkinter.Radiobutton(patient_data, text="Left arm", variable=arm,
                        value=1).grid(sticky='W')
    tkinter.Radiobutton(patient_data, text="Right arm", variable=arm,
                        value=2).grid(sticky='W')

    def win_des():
        global pat_name, pat_age
        pat_name = patient_name.get()
        pat_age = patient_age.get()
        window.destroy()

    # buttons exit and OK
    btn_exit = tkinter.Button(window, text="Exit", command=sys.exit, fg='red')
    btn_exit.grid(row=2, column=0, sticky='sw')

    btn_ok = tkinter.Button(window, text="Start", command=win_des, fg='green')
    btn_ok.grid(row=2, column=2, sticky='se')

    window.mainloop()
예제 #8
0
파일: pinsPane.py 프로젝트: Dickzilla/bikoy
 def __init__(self, master, tp=None, name='Load TP -> Select Pinref'):
     '''
     Constructor
     '''
     Labelframe.__init__(self, master)
     self.name = name
     self.tp = tp
     self.tree = Treeview(self)
     self.tree.pack(fill=BOTH, expand=True)
     self.config(width=400,
                 height=300,
                 relief=RIDGE,
                 text='Pin Definitions',
                 padding=10)
     #         self.tree.bind('<<TreeviewSelect>>', self.show_pinss)
     #         self.pin_view = Labelframe(self)
     self.pins = {}
     self.pingroups = {}
     self.load()
예제 #9
0
    def construct(self):
        """construct of LabelFrame and message

        Parameters
        ----------
        None

        Returns
        -------
        None
        """
        self.lf0 = Labelframe(self.parent, text=self.lf_text,
                              style='brown.TLabelframe')
        self.lf0.grid(column=0, row=0, padx=10, pady=10)
        self.mee_lbl = Label(self.lf0, text=self.mess_text,
                             style='brown.TLabel')
        self.mee_lbl.grid(row=2, column=0, pady=10, padx=10)

        self.make_entry()
예제 #10
0
    def load_params(self, master, test):
        master.config(text=test)
        self.param_tree = Treeview(master)
        self.param_tree.pack(fill=BOTH, expand=True)
        self.param_tree.heading('#0', text='Parameter')
        self.param_tree.config(columns=('value'))
        self.param_tree.column('value', width=100)
        self.param_tree.heading('value', text='Value')

        self.param_tree.insert('',
                               'end',
                               'delay',
                               text='DELAY',
                               values=self.params.get(test).get('delay'))
        self.param_tree.insert('',
                               'end',
                               'force',
                               text='FORCE',
                               values=self.params.get(test).get('force'))
        self.param_tree.insert('',
                               'end',
                               'lolim',
                               text='LOLIM',
                               values=self.params.get(test).get('lolim'))
        self.param_tree.insert('',
                               'end',
                               'hilim',
                               text='HILIM',
                               values=self.params.get(test).get('hilim'))
        self.param_tree.insert('',
                               'end',
                               'pinref',
                               text='PINREF',
                               values=self.params.get(test).get('pinref'))
        self.param_tree.insert('',
                               'end',
                               'testtype',
                               text='TESTTYPE',
                               values=self.params.get(test).get('testtype'))
        if self.pins_view: self.pins_view.destroy()
        self.pins_view = Labelframe(self)
        self.param_tree.bind('<<TreeviewSelect>>', self.show_pins)
예제 #11
0
 def analysis_parameters_changed(self):
     parameters = self.model.analysis_parameters.get()
     try:
         w.TPanedwindow2_p2_parameters.destroy()
     except Exception as e:
         pass
     w.TPanedwindow2_p2_parameters = Labelframe(text='Parameters')
     w.TPanedwindow2.add(w.TPanedwindow2_p2_parameters)
     w.scrollable_frame_parameters = ScrollableFrame(
         w.TPanedwindow2_p2_parameters)
     w.scrollable_frame_parameters.populateFormParameters(parameters)
예제 #12
0
    def __init__(self, window, base, **kwargs):
        Labelframe.__init__(self, window, **kwargs)
        self.base = base
        self.notebook = Notebook(self)
        self.notebook.grid(row=0, column=0, padx=5, pady=5)

        self.student = Frame(self.notebook)
        self.student.grid(row=0, column=0)
        self.student_list = Treeview(self.student,
                                     height=24,
                                     columns=("name", "pesel"),
                                     displaycolumns="name")
        self.student_list.heading('name', text="Nazwisko i imię", anchor='w')
        self.student_list.column('name', width=240)
        self.student_list['show'] = 'headings'
        self.student_list.grid(row=0, column=0)

        self.button = Button(self.student,
                             text="Usuń",
                             command=self.delete_from_student_list)
        self.button.grid(row=1, column=0)

        self.staff_meeting = Frame(self.notebook)
        self.staff_meeting.grid(row=0, column=0)
        self.table = Treeview(self.staff_meeting,
                              height=24,
                              columns=("name", "id", "student_id"),
                              displaycolumns="name")
        self.table.heading('name', text='Zespoły', anchor='w')
        self.table.column('name', width=235)
        self.table.column('#0', stretch=0, width=10)
        self.table.grid(row=0, column=0)
        self.delete_staffmeeting = Button(
            self.staff_meeting,
            text="Usuń wpis",
            command=self.delete_from_staffmeeting)
        self.delete_staffmeeting.grid(row=1, column=0)

        self.notebook.add(self.student, text="Dzieci")
        self.notebook.add(self.staff_meeting, text="Zespoły")
예제 #13
0
    def initUI(self, server):
      
        self.parent.title("TrackWise Service Manager")
        self.pack(fill=BOTH, expand = True, padx = 300)
        # self.centerWindow()

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

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

        svcsMenu = Menu(menubar)
        svcsMenu.add_command(label = "List Service Status", command = self.onStatus)
        svcsMenu.add_command(label = "Stop Services", command = self.onStop)
        svcsMenu.add_command(label = "Start Services", command = self.onStart)
        menubar.add_cascade(label = "Services", menu = svcsMenu)

        # svcs = ['TrackWise Tomcat', 'Web Services Tomcat', 'QMD Tomcat', 'Keystone Intake', 'ID Intake', 'TWC']
        svcs = server.getservices()
        hostname = server.gethostname().strip()
        servertype = server.gettype().strip()

        frame0 = Labelframe(self, text = "Server Details",  borderwidth = 1)
        frame0.grid(column = 0, row = 0, sticky = W)
        
        so = StringVar()
        svroverview = Message(frame0, textvariable = so, anchor = W, width = 300)
        svroverview.grid(column = 0, row = 0)
        sstr = "Server: {}\n".format(hostname)
        sstr += "Server Type: {}".format(servertype)
        so.set(sstr)
        
        
        frame1 = Labelframe(self, text = "Service Status", borderwidth = 1)
        frame1.grid(column = 0, row = 1, sticky = W)


        l = StringVar()
        label1 = Message(frame1, textvariable = l , anchor = W)
        
        svcscount = 0

        lstr = ""

        for i in svcs:
            svcscount += 1 
            lstr += '{} - '.format(i) + ('UP\n' if svcscount % 2 else 'DOWN\n')
      
            
        l.set(lstr)
        label1.pack(side=TOP, padx = 5, pady = 5)   

        frame4 = Frame(self, relief=RAISED, borderwidth = 1)
        frame4.grid(column = 0, row = 2, sticky = W)
        closeButton = Button(frame4, text="Close", command = self.quit)
        closeButton.grid(column = 0, row = 0)
        okButton = Button(frame4, text = "OK")
        okButton.grid(column = 1, row = 0)
예제 #14
0
 def __init__(self, master, tp=None, name='No TP Loaded'):
     '''
     Constructor
     '''
     Labelframe.__init__(self, master)
     self.name = name
     self.tp = tp
     self.tree = Treeview(self)
     self.tree.pack(fill=BOTH, expand=True)
     self.config(width=200,
                 height=200,
                 relief=RIDGE,
                 text='Test Program',
                 padding=10)
     self.tree.bind('<<TreeviewSelect>>', self.show_params)
     self.param_view = Labelframe(self)
     self.pins_view = Labelframe(self)
     self.params = {}
     self.pins = {}
     self.load()
예제 #15
0
    def __init__(self, window, base, **kwargs):
        Labelframe.__init__(self, window, **kwargs)
        self.base = base
        self.pesel_string = StringVar()
        self.pesel_string.set('')
        self.pesel_string.trace('w', lambda *args: self.pesel_validation())
        self.birth_date = ""

        self.name_of_student_n_lab = Label(self, text="Imię i nazwisko (m)")
        self.name_of_student_n_lab.grid(row=0,
                                        column=0,
                                        sticky='e',
                                        padx=5,
                                        pady=5)
        self.name_of_student_n_entry = Entry(self, width=41)
        self.name_of_student_n_entry.grid(row=0,
                                          column=1,
                                          columnspan=3,
                                          padx=5,
                                          pady=5,
                                          sticky='w')

        self.name_of_student_g_lab = Label(self, text="Imię i nazwisko (d)")
        self.name_of_student_g_lab.grid(row=1,
                                        column=0,
                                        sticky='e',
                                        padx=5,
                                        pady=5)
        self.name_of_student_g_entry = Entry(self, width=41)
        self.name_of_student_g_entry.grid(row=1,
                                          column=1,
                                          columnspan=3,
                                          padx=5,
                                          pady=5,
                                          sticky='w')

        self.pesel_lab = Label(self, text="PESEL")
        self.pesel_lab.grid(row=2, column=0, sticky='e', padx=5, pady=5)
        self.pesel_entry = Entry(self,
                                 textvariable=self.pesel_string,
                                 width=12)
        self.pesel_entry.grid(row=2, column=1, sticky='w', padx=5, pady=5)

        self.id_of_student = Label(self, text="Teczka")
        self.id_of_student.grid(row=2, column=2, padx=5, pady=5, sticky='e')
        self.id_of_student_entry = Entry(self, width=7)
        self.id_of_student_entry.grid(row=2, column=3, padx=5, pady=5)

        self.birth_place_lab = Label(self, text="Miejsce urodzenia")
        self.birth_place_lab.grid(row=3, column=0, sticky='e', padx=5, pady=5)
        self.birth_place_entry = Entry(self, width=25)
        self.birth_place_entry.grid(row=3,
                                    column=1,
                                    sticky='w',
                                    padx=5,
                                    pady=5)

        self.city_of_student_lab = Label(self, text="Miejscowość")
        self.city_of_student_lab.grid(row=4,
                                      column=0,
                                      sticky='e',
                                      padx=5,
                                      pady=5)
        self.city_of_student_entry = Entry(self, width=25)
        self.city_of_student_entry.grid(row=4,
                                        column=1,
                                        sticky='w',
                                        padx=5,
                                        pady=5)

        self.zip_code_of_student_lab = Label(self, text="Kod")
        self.zip_code_of_student_lab.grid(row=4,
                                          column=2,
                                          padx=5,
                                          pady=5,
                                          sticky='e')
        self.zip_code_of_student_entry = Entry(self, width=7)
        self.zip_code_of_student_entry.grid(row=4, column=3, padx=5, pady=5)

        self.address_of_student_lab = Label(self, text="Adres dziecka")
        self.address_of_student_lab.grid(row=5,
                                         column=0,
                                         sticky='e',
                                         padx=5,
                                         pady=5)
        self.address_of_student_entry = Entry(self, width=25)
        self.address_of_student_entry.grid(row=5,
                                           column=1,
                                           sticky='w',
                                           padx=5,
                                           pady=5)

        self.sort_of_school_lab = Label(self, text="Rodzaj szkoły")
        self.sort_of_school_lab.grid(row=6,
                                     column=0,
                                     sticky='e',
                                     padx=5,
                                     pady=5)
        self.sort_of_school_box = Combobox(self,
                                           postcommand=self.list_of_sorts,
                                           exportselection=False)
        self.sort_of_school_box.bind("<<ComboboxSelected>>",
                                     self.clear_all_selection)
        self.sort_of_school_box.grid(row=6,
                                     column=1,
                                     sticky='w',
                                     padx=5,
                                     pady=5)

        self.school_lab = Label(self, text="Szkoła:")
        self.school_lab.grid(row=7, column=0, sticky='e', padx=5, pady=5)
        self.school = Combobox(self,
                               width=40,
                               postcommand=self.list_of_schools,
                               exportselection=False)
        self.school.grid(row=7,
                         column=1,
                         columnspan=4,
                         sticky='w',
                         padx=5,
                         pady=5)
        self.school.bind("<<ComboboxSelected>>", self.list_of_schools())

        self.profession_lab = Label(self, text="Zawód")
        self.profession_lab.grid(row=8, column=0, sticky='e', padx=5, pady=5)
        self.profession_entry = Entry(self, width=25)
        self.profession_entry.grid(row=8, column=1, sticky='w', padx=5, pady=5)

        self.class_lab = Label(self, text="Klasa")
        self.class_lab.grid(row=8, column=2, padx=5, pady=5, sticky='e')
        self.class_entry = Entry(self, width=7)
        self.class_entry.grid(row=8, column=3)
예제 #16
0
파일: gui.py 프로젝트: karacho84/dinnerlog
class GUI(object):
    '''Stellt die Oberflaeche dar.
    
    Alle steuerden Taetigkeiten werden (sollten) vom
    Controller Objekt uebernommen werden.
    '''


    def __init__(self):
        '''
        Constructor
        '''
        self.root = Tk()
        
        self.root.title("DinnerLog")
        self.root.minsize(800, 600)
        self.root.grid_columnconfigure(0, weight=1)
        self.root.grid_rowconfigure(0, weight=1)
        self.root.grid_rowconfigure(1, weight=3)
        
        # Ein Frame für alles, das mit Zutaten zu tun hat
        self.fr_zutaten = Labelframe(self.root, borderwidth=2, relief=GROOVE, text="Zutaten")
        self.fr_zutaten.grid_columnconfigure(0, weight=1)
        self.fr_zutaten.grid_rowconfigure(0, weight=1)
        self.fr_zutaten.grid(row=0, column=0, sticky="NSWE")
        

        self.lb_zutaten = Listbox(self.fr_zutaten)
        sb_zutaten = Scrollbar(self.lb_zutaten, orient=VERTICAL)
        self.lb_zutaten.configure(yscrollcommand=sb_zutaten.set)
        sb_zutaten.config(command=self.lb_zutaten.yview)
        sb_zutaten.pack(side="right", fill="both")
        self.lb_zutaten.grid(row=0, column=0, sticky="NSEW")
        
        self._addNeueZutatFrame()    

        # Ein Frame in den alles, das mit Mahlzeiten zu tun hat, kommt
        self.fr_mahlzeit = Labelframe(self.root, borderwidth=2, relief=GROOVE, text="Mahlzeiten")
        self.fr_mahlzeit.grid_columnconfigure(0, weight=1)
        self.fr_mahlzeit.grid_rowconfigure(0, weight=1)
        self.fr_mahlzeit.grid(row=1, column=0, sticky="NSWE")
        
        self._addNeueMahlzeitFrame()
        

        self.lb_mahlzeiten = Listbox(self.fr_mahlzeit, selectmode=SINGLE)
        sb_mahlzeiten = Scrollbar(self.lb_mahlzeiten, orient=VERTICAL)
        sb_mahlzeiten.configure(command=self.lb_mahlzeiten.yview)
        self.lb_mahlzeiten.configure(yscrollcommand=sb_mahlzeiten.set)
        sb_mahlzeiten.pack(side="right", fill="both")
        self.lb_mahlzeiten.grid(row=0, column=0, sticky="NSEW")
        
        fr_neu_ok = Frame(self.fr_mahlzeit)
        fr_neu_ok.grid(row=1, column=0, columnspan=2, sticky="E")
    
        self.btn_neu = Button(fr_neu_ok, text="Neu")
        self.btn_neu.pack(side="left")
        
        self.btn_mahlzeit_als_zt = Button(fr_neu_ok, text="Als Zutat")
        self.btn_mahlzeit_als_zt.pack(anchor=E, side="right")
        
        self.btn_insert = Button(fr_neu_ok, text="Hinzufuegen")
        self.btn_insert.pack(anchor=E, side="right")
        
        self.btn_update = Button(fr_neu_ok, text="Update")
        self.btn_update.pack(anchor=E, side="right")
        
        self.btn_delete = Button(fr_neu_ok, text="Loeschen")
        self.btn_delete.pack(anchor=E, side="right")
        
        # Ein Frame der Statistiken darstellt
        self.fr_stats = Labelframe(self.root, borderwidth=2, relief=GROOVE, text="Statistik")
        self.fr_stats.grid(row=3, column=0, sticky="NSWE")

        #self.cv_stats = Canvas(self.fr_stats, height=80, width=600)
        #self.cv_stats.create_line(2,5,598,5, fill="#bbb")
        
    def _addNeueMahlzeitFrame(self):
        self.fr_neue_mz = Frame(self.fr_mahlzeit)
        self.fr_neue_mz.grid_rowconfigure(2, weight=1)
        self.fr_neue_mz.grid(row=0, column=1, sticky="WSNE")
        
        lbl_name = Label(self.fr_neue_mz, text="Name:")
        lbl_name.grid(row=0, column=0, sticky="NW")
        
        self.en_name = Entry(self.fr_neue_mz)
        self.en_name.grid(row=0, column=1, columnspan=2, sticky="WNE")
        
        lbl_zutat = Label(self.fr_neue_mz, text="Zutaten:")
        lbl_zutat.grid(row=1, column=0, sticky="NW")
        

        self.lb_zutat = Listbox(self.fr_neue_mz)
        sb_zutat = Scrollbar(self.lb_zutat, orient=VERTICAL)
        self.lb_zutat.configure(yscrollcommand=sb_zutat.set)
        sb_zutat.configure(command=self.lb_zutat.yview)
        sb_zutat.pack(side="right", fill="both")
        self.lb_zutat.grid(row=2, column=0, columnspan=3, sticky="NWSE")
        
        self.var_zutat = StringVar(self.fr_neue_mz)
        
        self.opt_zutat = OptionMenu(self.fr_neue_mz, self.var_zutat, "Auswahl")
        self.opt_zutat.grid(row=3, column=0)
        
        self.en_menge = Entry(self.fr_neue_mz)
        self.en_menge.grid(row=3, column=1)
        
        self.btn_mahlzeit_hinzu = Button(self.fr_neue_mz, text="Hinzu")
        self.btn_mahlzeit_hinzu.grid(row=3, column=2, sticky="E")
        
    def _addNeueZutatFrame(self):
        fr_neue_zt = Frame(self.fr_zutaten)
        fr_neue_zt.grid(row=0, column=2,sticky="NWSE")
        
        lbl_name = Label(fr_neue_zt, text="Name:")
        lbl_name.grid(row=0, column=0, sticky="W")
        
        self.en_name_zt = Entry(fr_neue_zt)
        self.en_name_zt.grid(row=0, column=1, columnspan=2, sticky="WE")
        
        lbl_fett = Label(fr_neue_zt, text="Fett:")
        lbl_fett.grid(row=1, column=0, sticky="W")        
        
        self.en_fett = Entry(fr_neue_zt)
        self.en_fett.grid(row=1, column=1, columnspan=2)
        
        lbl_eiweiss = Label(fr_neue_zt, text="Eiweiss:")
        lbl_eiweiss.grid(row=2, column=0, sticky="W")        
        
        self.en_eiweiss = Entry(fr_neue_zt)
        self.en_eiweiss.grid(row=2, column=1, columnspan=2)
        
        lbl_kh = Label(fr_neue_zt, text="Kohlenhy.:")
        lbl_kh.grid(row=3, column=0, sticky="W")        
        
        self.en_kh = Entry(fr_neue_zt)
        self.en_kh.grid(row=3, column=1, columnspan=2)
        
        self.btn_zutat_insert = Button(fr_neue_zt, text="Hinzu")
        self.btn_zutat_insert.grid(row=4, column=1, sticky="E")
        
        self.btn_zutat_update = Button(fr_neue_zt, text="Update")
        self.btn_zutat_update.grid(row=5, column=1, sticky="E")
        
        self.btn_zutat_delete = Button(fr_neue_zt, text="Loeschen")
        self.btn_zutat_delete.grid(row=6, column=1, sticky="E")
예제 #17
0
class TabFiles(Frame):
    def __init__(self,
                 parent,
                 txt: dict = dict(),
                 path_browser=None,
                 path_var: str = ""):
        """Instanciating the output workbook."""
        self.p = parent
        self.txt = txt
        Frame.__init__(self)

        # -- VARIABLES -------------------------------------------------------
        self.target_path = StringVar()
        # formats / type: vectors
        self.li_vectors_formats = (
            ".shp",
            ".tab",
            ".kml",
            ".gml",
            ".geojson",
        )  # vectors handled
        self.li_shp = []  # list for shapefiles path
        self.li_tab = []  # list for MapInfo tables path
        self.li_kml = []  # list for KML path
        self.li_gml = []  # list for GML path
        self.li_geoj = []  # list for GeoJSON paths
        self.li_gxt = []  # list for GXT paths
        self.li_vectors = []  # list for all vectors
        # formats / type: rasters
        self.li_raster = []  # list for rasters paths
        self.li_raster_formats = (".ecw", ".tif", ".jp2")  # raster handled
        # formats / type: file databases
        self.li_fdb = []  # list for all files databases
        self.li_egdb = []  # list for Esri File Geodatabases
        self.li_spadb = []  # list for Spatialite Geodatabases
        # formats / type: CAO/DAO
        self.li_cdao = []  # list for all CAO/DAO files
        self.li_dxf = []  # list for AutoCAD DXF paths
        self.li_dwg = []  # list for AutoCAD DWG paths
        self.li_dgn = []  # list for MicroStation DGN paths
        # formats / type: maps documents
        self.li_mapdocs = []  # list for all map & documents
        self.li_qgs = []  # list for QGS path

        # -- Source path -----------------------------------------------------
        self.FrPath = Labelframe(self,
                                 name="files",
                                 text=txt.get("gui_fr1", "Path"))

        # target folder
        self.lb_target = Label(self.FrPath, text=txt.get("gui_path"))
        self.ent_target = Entry(master=self.FrPath,
                                width=35,
                                textvariable=self.target_path)
        self.btn_browse = Button(
            self.FrPath,
            text="\U0001F3AF " + txt.get("gui_choix", "Browse"),
            command=lambda: self.get_target_path(r"."),
            takefocus=True,
        )
        self.btn_browse.focus_force()

        # widgets placement
        self.lb_target.grid(row=1,
                            column=1,
                            columnspan=1,
                            sticky="NSWE",
                            padx=2,
                            pady=2)
        self.ent_target.grid(row=1,
                             column=2,
                             columnspan=1,
                             sticky="NSWE",
                             padx=2,
                             pady=2)
        self.btn_browse.grid(row=1, column=3, sticky="NSE", padx=2, pady=2)

        # -- Format filters --------------------------------------------------
        self.FrFilters = Labelframe(self,
                                    name="filters",
                                    text=txt.get("gui_fr3", "Filters"))
        # formats options
        self.opt_shp = IntVar(self.FrFilters)  # able/disable shapefiles
        self.opt_tab = IntVar(self.FrFilters)  # able/disable MapInfo tables
        self.opt_kml = IntVar(self.FrFilters)  # able/disable KML
        self.opt_gml = IntVar(self.FrFilters)  # able/disable GML
        self.opt_geoj = IntVar(self.FrFilters)  # able/disable GeoJSON
        self.opt_gxt = IntVar(self.FrFilters)  # able/disable GXT
        self.opt_egdb = IntVar(self.FrFilters)  # able/disable Esri FileGDB
        self.opt_spadb = IntVar(self.FrFilters)  # able/disable Spatalite DB
        self.opt_rast = IntVar(self.FrFilters)  # able/disable rasters
        self.opt_cdao = IntVar(self.FrFilters)  # able/disable CAO/DAO files
        self.opt_qgs = IntVar(self.FrFilters)  # able/disable Geospatial QGS

        # format choosen: check buttons
        caz_shp = Checkbutton(self.FrFilters,
                              text=".shp",
                              variable=self.opt_shp)
        caz_tab = Checkbutton(self.FrFilters,
                              text=".tab",
                              variable=self.opt_tab)
        caz_kml = Checkbutton(self.FrFilters,
                              text=".kml",
                              variable=self.opt_kml)
        caz_gml = Checkbutton(self.FrFilters,
                              text=".gml",
                              variable=self.opt_gml)
        caz_geoj = Checkbutton(self.FrFilters,
                               text=".geojson",
                               variable=self.opt_geoj)
        caz_gxt = Checkbutton(self.FrFilters,
                              text=".gxt",
                              variable=self.opt_gxt)
        caz_egdb = Checkbutton(self.FrFilters,
                               text="Esri FileGDB",
                               variable=self.opt_egdb)
        caz_spadb = Checkbutton(self.FrFilters,
                                text="Spatialite",
                                variable=self.opt_spadb)
        caz_rast = Checkbutton(
            self.FrFilters,
            text="rasters ({0})".format(", ".join(self.li_raster_formats)),
            variable=self.opt_rast,
        )
        caz_cdao = Checkbutton(self.FrFilters,
                               text="CAO/DAO",
                               variable=self.opt_cdao)
        # widgets placement
        caz_shp.grid(row=1, column=0, sticky="NSWE", padx=2, pady=2)
        caz_tab.grid(row=1, column=1, sticky="NSWE", padx=2, pady=2)
        caz_kml.grid(row=1, column=2, sticky="NSWE", padx=2, pady=2)
        caz_gml.grid(row=1, column=3, sticky="NSWE", padx=2, pady=2)
        caz_geoj.grid(row=1, column=4, sticky="NSWE", padx=2, pady=2)
        caz_gxt.grid(row=1, column=5, sticky="NSWE", padx=2, pady=2)
        caz_rast.grid(row=2,
                      column=0,
                      columnspan=2,
                      sticky="NSWE",
                      padx=2,
                      pady=2)
        caz_egdb.grid(row=2,
                      column=2,
                      columnspan=2,
                      sticky="NSWE",
                      padx=2,
                      pady=2)
        caz_cdao.grid(row=2,
                      column=4,
                      columnspan=1,
                      sticky="NSWE",
                      padx=2,
                      pady=2)
        caz_spadb.grid(row=2,
                       column=5,
                       columnspan=2,
                       sticky="NSWE",
                       padx=2,
                       pady=2)

        # frames placement
        self.FrPath.grid(row=3, column=1, padx=2, pady=2, sticky="NSWE")
        self.FrFilters.grid(row=4, column=1, padx=2, pady=2, sticky="NSWE")

    def get_target_path(self, def_rep) -> str:
        """Browse and insert the path of target folder."""
        foldername = askdirectory(
            parent=self.p,
            initialdir=def_rep,
            mustexist=True,
            title=_("Pick DicoGIS start folder"),
        )

        # check if a folder has been choosen
        if foldername:
            try:
                self.ent_target.delete(0, END)
                self.ent_target.insert(0, foldername)
            except Exception as e:
                logger.info(e)
                showinfo(title=self.txt.get("nofolder"),
                         message=self.txt.get("nofolder"))
                return
        else:
            pass

        # set the default output file
        self.p.master.ent_outxl_filename.delete(0, END)
        self.p.master.ent_outxl_filename.insert(
            0,
            "DicoGIS_{0}_{1}.xlsx".format(
                path.split(self.target_path.get())[1], today),
        )

        # count geofiles in a separated thread
        proc = threading.Thread(target=self.p.master.ligeofiles,
                                args=(foldername, ))
        proc.daemon = True
        proc.start()

        # end of function
        return foldername
예제 #18
0
    def __init__(self,
                 parent,
                 txt: dict = dict(),
                 path_browser=None,
                 path_var: str = ""):
        """Instanciating the output workbook."""
        self.p = parent
        self.txt = txt
        Frame.__init__(self)

        # -- VARIABLES -------------------------------------------------------
        self.target_path = StringVar()
        # formats / type: vectors
        self.li_vectors_formats = (
            ".shp",
            ".tab",
            ".kml",
            ".gml",
            ".geojson",
        )  # vectors handled
        self.li_shp = []  # list for shapefiles path
        self.li_tab = []  # list for MapInfo tables path
        self.li_kml = []  # list for KML path
        self.li_gml = []  # list for GML path
        self.li_geoj = []  # list for GeoJSON paths
        self.li_gxt = []  # list for GXT paths
        self.li_vectors = []  # list for all vectors
        # formats / type: rasters
        self.li_raster = []  # list for rasters paths
        self.li_raster_formats = (".ecw", ".tif", ".jp2")  # raster handled
        # formats / type: file databases
        self.li_fdb = []  # list for all files databases
        self.li_egdb = []  # list for Esri File Geodatabases
        self.li_spadb = []  # list for Spatialite Geodatabases
        # formats / type: CAO/DAO
        self.li_cdao = []  # list for all CAO/DAO files
        self.li_dxf = []  # list for AutoCAD DXF paths
        self.li_dwg = []  # list for AutoCAD DWG paths
        self.li_dgn = []  # list for MicroStation DGN paths
        # formats / type: maps documents
        self.li_mapdocs = []  # list for all map & documents
        self.li_qgs = []  # list for QGS path

        # -- Source path -----------------------------------------------------
        self.FrPath = Labelframe(self,
                                 name="files",
                                 text=txt.get("gui_fr1", "Path"))

        # target folder
        self.lb_target = Label(self.FrPath, text=txt.get("gui_path"))
        self.ent_target = Entry(master=self.FrPath,
                                width=35,
                                textvariable=self.target_path)
        self.btn_browse = Button(
            self.FrPath,
            text="\U0001F3AF " + txt.get("gui_choix", "Browse"),
            command=lambda: self.get_target_path(r"."),
            takefocus=True,
        )
        self.btn_browse.focus_force()

        # widgets placement
        self.lb_target.grid(row=1,
                            column=1,
                            columnspan=1,
                            sticky="NSWE",
                            padx=2,
                            pady=2)
        self.ent_target.grid(row=1,
                             column=2,
                             columnspan=1,
                             sticky="NSWE",
                             padx=2,
                             pady=2)
        self.btn_browse.grid(row=1, column=3, sticky="NSE", padx=2, pady=2)

        # -- Format filters --------------------------------------------------
        self.FrFilters = Labelframe(self,
                                    name="filters",
                                    text=txt.get("gui_fr3", "Filters"))
        # formats options
        self.opt_shp = IntVar(self.FrFilters)  # able/disable shapefiles
        self.opt_tab = IntVar(self.FrFilters)  # able/disable MapInfo tables
        self.opt_kml = IntVar(self.FrFilters)  # able/disable KML
        self.opt_gml = IntVar(self.FrFilters)  # able/disable GML
        self.opt_geoj = IntVar(self.FrFilters)  # able/disable GeoJSON
        self.opt_gxt = IntVar(self.FrFilters)  # able/disable GXT
        self.opt_egdb = IntVar(self.FrFilters)  # able/disable Esri FileGDB
        self.opt_spadb = IntVar(self.FrFilters)  # able/disable Spatalite DB
        self.opt_rast = IntVar(self.FrFilters)  # able/disable rasters
        self.opt_cdao = IntVar(self.FrFilters)  # able/disable CAO/DAO files
        self.opt_qgs = IntVar(self.FrFilters)  # able/disable Geospatial QGS

        # format choosen: check buttons
        caz_shp = Checkbutton(self.FrFilters,
                              text=".shp",
                              variable=self.opt_shp)
        caz_tab = Checkbutton(self.FrFilters,
                              text=".tab",
                              variable=self.opt_tab)
        caz_kml = Checkbutton(self.FrFilters,
                              text=".kml",
                              variable=self.opt_kml)
        caz_gml = Checkbutton(self.FrFilters,
                              text=".gml",
                              variable=self.opt_gml)
        caz_geoj = Checkbutton(self.FrFilters,
                               text=".geojson",
                               variable=self.opt_geoj)
        caz_gxt = Checkbutton(self.FrFilters,
                              text=".gxt",
                              variable=self.opt_gxt)
        caz_egdb = Checkbutton(self.FrFilters,
                               text="Esri FileGDB",
                               variable=self.opt_egdb)
        caz_spadb = Checkbutton(self.FrFilters,
                                text="Spatialite",
                                variable=self.opt_spadb)
        caz_rast = Checkbutton(
            self.FrFilters,
            text="rasters ({0})".format(", ".join(self.li_raster_formats)),
            variable=self.opt_rast,
        )
        caz_cdao = Checkbutton(self.FrFilters,
                               text="CAO/DAO",
                               variable=self.opt_cdao)
        # widgets placement
        caz_shp.grid(row=1, column=0, sticky="NSWE", padx=2, pady=2)
        caz_tab.grid(row=1, column=1, sticky="NSWE", padx=2, pady=2)
        caz_kml.grid(row=1, column=2, sticky="NSWE", padx=2, pady=2)
        caz_gml.grid(row=1, column=3, sticky="NSWE", padx=2, pady=2)
        caz_geoj.grid(row=1, column=4, sticky="NSWE", padx=2, pady=2)
        caz_gxt.grid(row=1, column=5, sticky="NSWE", padx=2, pady=2)
        caz_rast.grid(row=2,
                      column=0,
                      columnspan=2,
                      sticky="NSWE",
                      padx=2,
                      pady=2)
        caz_egdb.grid(row=2,
                      column=2,
                      columnspan=2,
                      sticky="NSWE",
                      padx=2,
                      pady=2)
        caz_cdao.grid(row=2,
                      column=4,
                      columnspan=1,
                      sticky="NSWE",
                      padx=2,
                      pady=2)
        caz_spadb.grid(row=2,
                       column=5,
                       columnspan=2,
                       sticky="NSWE",
                       padx=2,
                       pady=2)

        # frames placement
        self.FrPath.grid(row=3, column=1, padx=2, pady=2, sticky="NSWE")
        self.FrFilters.grid(row=4, column=1, padx=2, pady=2, sticky="NSWE")
예제 #19
0
파일: gui.py 프로젝트: karacho84/dinnerlog
    def __init__(self):
        '''
        Constructor
        '''
        self.root = Tk()
        
        self.root.title("DinnerLog")
        self.root.minsize(800, 600)
        self.root.grid_columnconfigure(0, weight=1)
        self.root.grid_rowconfigure(0, weight=1)
        self.root.grid_rowconfigure(1, weight=3)
        
        # Ein Frame für alles, das mit Zutaten zu tun hat
        self.fr_zutaten = Labelframe(self.root, borderwidth=2, relief=GROOVE, text="Zutaten")
        self.fr_zutaten.grid_columnconfigure(0, weight=1)
        self.fr_zutaten.grid_rowconfigure(0, weight=1)
        self.fr_zutaten.grid(row=0, column=0, sticky="NSWE")
        

        self.lb_zutaten = Listbox(self.fr_zutaten)
        sb_zutaten = Scrollbar(self.lb_zutaten, orient=VERTICAL)
        self.lb_zutaten.configure(yscrollcommand=sb_zutaten.set)
        sb_zutaten.config(command=self.lb_zutaten.yview)
        sb_zutaten.pack(side="right", fill="both")
        self.lb_zutaten.grid(row=0, column=0, sticky="NSEW")
        
        self._addNeueZutatFrame()    

        # Ein Frame in den alles, das mit Mahlzeiten zu tun hat, kommt
        self.fr_mahlzeit = Labelframe(self.root, borderwidth=2, relief=GROOVE, text="Mahlzeiten")
        self.fr_mahlzeit.grid_columnconfigure(0, weight=1)
        self.fr_mahlzeit.grid_rowconfigure(0, weight=1)
        self.fr_mahlzeit.grid(row=1, column=0, sticky="NSWE")
        
        self._addNeueMahlzeitFrame()
        

        self.lb_mahlzeiten = Listbox(self.fr_mahlzeit, selectmode=SINGLE)
        sb_mahlzeiten = Scrollbar(self.lb_mahlzeiten, orient=VERTICAL)
        sb_mahlzeiten.configure(command=self.lb_mahlzeiten.yview)
        self.lb_mahlzeiten.configure(yscrollcommand=sb_mahlzeiten.set)
        sb_mahlzeiten.pack(side="right", fill="both")
        self.lb_mahlzeiten.grid(row=0, column=0, sticky="NSEW")
        
        fr_neu_ok = Frame(self.fr_mahlzeit)
        fr_neu_ok.grid(row=1, column=0, columnspan=2, sticky="E")
    
        self.btn_neu = Button(fr_neu_ok, text="Neu")
        self.btn_neu.pack(side="left")
        
        self.btn_mahlzeit_als_zt = Button(fr_neu_ok, text="Als Zutat")
        self.btn_mahlzeit_als_zt.pack(anchor=E, side="right")
        
        self.btn_insert = Button(fr_neu_ok, text="Hinzufuegen")
        self.btn_insert.pack(anchor=E, side="right")
        
        self.btn_update = Button(fr_neu_ok, text="Update")
        self.btn_update.pack(anchor=E, side="right")
        
        self.btn_delete = Button(fr_neu_ok, text="Loeschen")
        self.btn_delete.pack(anchor=E, side="right")
        
        # Ein Frame der Statistiken darstellt
        self.fr_stats = Labelframe(self.root, borderwidth=2, relief=GROOVE, text="Statistik")
        self.fr_stats.grid(row=3, column=0, sticky="NSWE")
예제 #20
0
    def __init_components(self):
        # Instanciar widgets
        self.panel_form = Labelframe(self, text='Tarea')
        self.panel_tasks = Labelframe(self, text='Tareas por hacer')
        self.panel_complete_tasks = Labelframe(self, text='Tareas completas')

        self.label_name = Label(self.panel_form, text='Nombre:')
        self.label_description = Label(self.panel_form, text='Descripción:')
        self.entry_name = Entry(self.panel_form)
        self.entry_description = Entry(self.panel_form)

        self.btn_modify_task = Button(self.panel_form,
                                      text='Editar tarea',
                                      state=DISABLED,
                                      command=self.__modify_task)
        self.btn_new_task = Button(self.panel_form,
                                   text='Nueva tarea',
                                   command=self.__new_task)
        self.btn_delete_task = Button(self.panel_form,
                                      text='Eliminar tarea',
                                      state=DISABLED,
                                      command=self.__delete_task)
        self.btn_clear_form = Button(self.panel_form,
                                     text='Limpiar campos',
                                     command=self.__clear_form)
        self.btn_complete_task = Button(self.panel_form,
                                        text='Completar tarea',
                                        state=DISABLED,
                                        command=self.__complete_task)

        self.scroll_tasks = Scrollbar(self.panel_tasks, orient=VERTICAL)
        self.scroll_complete_tasks = Scrollbar(self.panel_complete_tasks,
                                               orient=VERTICAL)
        self.list_tasks = Listbox(self.panel_tasks,
                                  selectmode=SINGLE,
                                  height=10,
                                  width=25,
                                  yscrollcommand=self.scroll_tasks.set)
        self.list_complete_tasks = Listbox(
            self.panel_complete_tasks,
            selectmode=SINGLE,
            height=10,
            width=25,
            yscrollcommand=self.scroll_complete_tasks.set)

        # Posicionar los widgets
        # Panel de formulario de tareas
        self.panel_form.pack(fill='both',
                             expand='yes',
                             padx=10,
                             pady=5,
                             ipadx=5,
                             ipady=5)
        self.panel_form.columnconfigure(0, weight=1)
        self.panel_form.rowconfigure(0, weight=1)

        self.label_name.grid(row=0, column=0, padx=5, sticky='w')
        self.entry_name.grid(row=0, column=1, padx=5, sticky='w')
        self.label_description.grid(row=1,
                                    column=0,
                                    padx=5,
                                    pady=5,
                                    sticky='w')
        self.entry_description.grid(row=1,
                                    column=1,
                                    padx=5,
                                    pady=10,
                                    sticky='w')

        # Botones
        self.btn_modify_task.grid(row=2, column=0, ipady=4, sticky='we')
        self.btn_new_task.grid(row=2, column=1, ipady=4, sticky='we')
        self.btn_delete_task.grid(row=3, column=0, ipady=4, sticky='we')
        self.btn_clear_form.grid(row=3, column=1, ipady=4, sticky='we')
        self.btn_complete_task.grid(row=4,
                                    column=0,
                                    columnspan=2,
                                    ipady=4,
                                    sticky='we')

        config_list = {
            'fill': 'both',
            'expand': 'yes',
            'padx': 10,
            'pady': 5,
            'ipadx': 5,
            'ipady': 5
        }

        # Panel de lista de tareas pendientes
        self.panel_tasks.pack(config_list)
        self.panel_tasks.columnconfigure(0, weight=20)
        self.panel_tasks.columnconfigure(1, weight=1)
        self.list_tasks.grid(row=0, column=0, sticky='we')
        self.scroll_tasks.configure(command=self.list_tasks.yview)
        self.scroll_tasks.grid(row=0, column=1, sticky='ns')

        # Panel de lista de tareas completas
        self.panel_complete_tasks.pack(config_list)
        self.panel_complete_tasks.columnconfigure(0, weight=20)
        self.panel_complete_tasks.columnconfigure(1, weight=1)
        self.list_complete_tasks.grid(row=0, column=0, sticky='we')
        self.scroll_complete_tasks.configure(
            command=self.list_complete_tasks.yview)
        self.scroll_complete_tasks.grid(row=0, column=1, sticky='ns')
예제 #21
0
class StringEntry:
    """String class for entry
        added colour, change state

    Parameters
    ----------
    parent : str
        parent handle
    lf_text : str
        text on LabelFrame
    mess_text : str
        message
    def_text : str
        default text
    colour : str
        frame colour
    mod : str
        enable or disable state switch

    Returns
    -------
    string
    """
    def __init__(self,
                 parent,
                 lf_text,
                 mess_text,
                 def_text="",
                 colour='brown',
                 mod=False):
        self.parent = parent
        self.lf_text = lf_text
        self.mess_text = mess_text
        self.mod = mod

        self.out_var = StringVar()
        self.out_var.set(def_text)

        self.farbe = farbe = {
            'blue': 'light blue',
            'brown': '#EDEF77',
            'green': 'light green',
            'pink': '#EAAFBF'
        }

        colour = colour if colour in farbe else 'brown'

        self.colour = colour

        st1 = Style()
        st1.theme_use('default')

        st1.configure(colour + '.TLabelframe', background='#C9B99B')
        st1.configure(colour + '.TLabelframe.Label', background=farbe[colour])
        st1.configure(colour + '.TCheckbutton', background=farbe[colour])
        st1.configure('brown.TLabel', background='#EDEF77')

        self.construct()

    def construct(self):
        """construct of LabelFrame and message

        Parameters
        ----------
        None

        Returns
        -------
        None
        """
        self.lf1 = Labelframe(self.parent,
                              text=self.lf_text,
                              style=self.colour + '.TLabelframe')
        self.lf1.grid(column=0, row=0, padx=10, pady=10)
        self.messlbl = Label(self.lf1,
                             text=self.mess_text,
                             style='brown.TLabel')
        self.messlbl.grid(row=2, column=0, pady=10, padx=10)

        self.make_entry()

    def make_entry(self):
        """construct of Entry

        Parameters
        ----------
        None

        Returns
        -------
        None
        """
        vcmd = self.lf1.register(self.is_okay)

        self.ent1 = ent1 = Entry(self.lf1,
                                 validate='key',
                                 validatecommand=(vcmd, '%P', '%S', '%i'),
                                 textvariable=self.out_var)
        ent1.bind("<Return>", self.end_input)
        ent1.grid(row=1, column=0, padx=10)
        ent1.focus()

        if self.mod in (True, False):
            self.modify()

    def modify(self):
        """construct of state switch

        Parameters
        ----------
        None

        Returns
        -------
        None
        """
        lf_text = self.lf_text
        # entry disabled until checkbox is ticked
        self.cb_opt = Checkbutton(self.lf1,
                                  command=self.toggle_opt,
                                  style=self.colour + '.TCheckbutton')
        self.lf1['labelwidget'] = self.cb_opt
        if self.mod:
            self.ent1.state(['!disabled'])
            self.cb_opt.state(['!selected'])
            self.cb_opt['text'] = lf_text + ' Check to prevent editing '
            self.ent1.focus()
        else:
            self.ent1.state(['disabled'])
            self.cb_opt.state(['selected'])
            self.cb_opt['text'] = lf_text + ' Check to modify '

    def toggle_opt(self):
        """state switch logic

        Parameters
        ----------
        None

        Returns
        -------
        None
        """
        lf_text = self.lf_text
        #       state of entry controlled
        #       by the state of the check button in Option frame label widget
        if self.cb_opt.instate(['selected']):
            print('selected state')
            self.ent1.state(['disabled'])
            self.cb_opt['text'] = lf_text + ' Check to modify '
        else:
            print('unselected state')
            self.ent1.state(['!disabled'])  # enable option
            self.cb_opt['text'] = lf_text + ' Check to prevent editing '
            self.ent1.focus()

    def end_input(self, _evt):
        """limit on string

        Parameters
        ----------
        evt : str
            bind handle

        Returns
        -------
        None
        """
        if len(self.out_var.get()) > 5:
            self.messlbl['text'] = "That's OK"
        else:
            self.messlbl['text'] = "Should be at least 6 characters long"

    def is_okay(self, text, inp, ind):
        """ validation function

        Parameters
        ----------
        text : str
            text if allowed
        inp : str
            current input

        Returns
        -------
        boolean
        """
        ind = int(ind)
        print(ind)
        if (inp.isalnum() or inp in (",", ".", "'", " ")) and ind > 0:
            return True
        else:
            return bool((text.isupper() or text == "") and ind == 0)
예제 #22
0
def entry_float(parent, lf_text, l_limit, u_limit, mess_text, out_var):
    """Float layout for entry

    Parameters
    ----------
    parent : str
        parent handle
    lf_text : str
        text on LabelFrame
    l_limit : float
        lower limit
    u_limit : float
        upper limit
    mess_text : str
        message
    out_var : float
        tkvar handle

    Returns
    -------
    float
    """
    st1 = Style()
    st1.theme_use('default')

    st1.configure('brown.TLabelframe', background='#C9B99B')
    st1.configure('brown.TLabelframe.Label', background='#EDEF77')
    st1.configure('brown.TLabel', background='#EDEF77')
    st1.configure('lowr.TLabel', background='lightblue')
    st1.configure('upr.TLabel', background='red')

    lf0 = Labelframe(parent, text=lf_text, style='brown.TLabelframe')
    lf0.grid(row=0, column=0, padx=10, pady=10)

    ulab = Label(lf0,
                 text=str(u_limit) + "  upper limit",
                 style='brown.TLabel')
    ulab.grid(row=0, column=1, padx=10)
    llab = Label(lf0,
                 text=str(l_limit) + "  lower limit",
                 style='brown.TLabel')
    llab.grid(row=2, column=1, padx=10)

    def end_input(_evt):
        """limit on float

        Parameters
        ----------
        evt : str
            bind handle

        Returns
        -------
        None
        """
        ulab['style'] = 'brown.TLabel'
        llab['style'] = 'brown.TLabel'
        if l_limit < entsv.get() < u_limit:
            messlbl['text'] = "That's OK"
            out_var.set(entsv.get())
        elif l_limit >= entsv.get():
            messlbl['text'] = "Input below lower limit"
            llab['style'] = 'lowr.TLabel'
        else:
            messlbl['text'] = "Input above upper limit"
            ulab['style'] = 'upr.TLabel'

    def is_okay(text):
        """ validation function

        Parameters
        ----------
        text : str
            text if allowed

        Returns
        -------
        boolean
        """
        if text in ("", "-", ".", "-."):
            return True
        try:
            float(text)
        except ValueError:
            return False
        return True

    vcmd = lf0.register(is_okay)

    entsv = DoubleVar()
    ent0 = Entry(lf0,
                 validate='key',
                 validatecommand=(vcmd, '%P'),
                 textvariable=entsv)
    ent0.bind("<Return>", end_input)
    ent0.grid(row=1, column=0, padx=10)
    ent0.focus()

    messlbl = Label(lf0, text=mess_text, style='brown.TLabel')
    messlbl.grid(row=2, column=0, pady=10, padx=10)
예제 #23
0
class StringEntry:
    """String class for entry
        06layout_string converted to a class

    Parameters
    ----------
    parent : str
        parent handle
    lf_text : str
        text on LabelFrame
    mess_text : str
        message
    outVar : float
        tkvar handle

    Returns
    -------
    string
    """
    def __init__(self, parent, lf_text, mess_text):
        self.parent = parent
        self.lf_text = lf_text
        self.mess_text = mess_text

        self.out_var = StringVar()

        st1 = Style()
        st1.theme_use('default')

        st1.configure('brown.TLabelframe', background='#C9B99B')
        st1.configure('brown.TLabelframe.Label', background='#EDEF77')
        st1.configure('brown.TLabel', background='#EDEF77')

        self.construct()

    def construct(self):
        """construct of LabelFrame and message

        Parameters
        ----------
        None

        Returns
        -------
        None
        """
        self.lf0 = Labelframe(self.parent, text=self.lf_text,
                              style='brown.TLabelframe')
        self.lf0.grid(column=0, row=0, padx=10, pady=10)
        self.mee_lbl = Label(self.lf0, text=self.mess_text,
                             style='brown.TLabel')
        self.mee_lbl.grid(row=2, column=0, pady=10, padx=10)

        self.make_entry()

    def make_entry(self):
        """construct of Entry

        Parameters
        ----------
        None

        Returns
        -------
        None
        """
        vcmd = self.lf0.register(self.is_okay)

        ent0 = Entry(self.lf0, validatecommand=(vcmd, '%P', '%S', '%i'),
                     validate='key', textvariable=self.out_var)
        ent0.bind("<Return>", self.end_input)
        ent0.grid(row=1, column=0, padx=10)
        ent0.focus()

    def end_input(self, _evt):
        """limit on string

        Parameters
        ----------
        evt : str
            bind handle

        Returns
        -------
        None
        """
        if len(self.out_var.get()) > 5:
            self.mee_lbl['text'] = "That's OK"
        else:
            self.mee_lbl['text'] = "Should be at least 6 characters long"

    def is_okay(self, text, input, index):
        """ validation function

        Parameters
        ----------
        text : str
            text if allowed
        input : str
            current input

        Returns
        -------
        boolean
        """
        #print(text)
        index = int(index)
        print(index)
        if (input.isalnum() or input in (",", ".", "'", " ")) and index > 0:
            return True
        else:
            return bool((text.isupper() or text == "") and index == 0)
예제 #24
0
from tkinter import Tk, StringVar
from tkinter.ttk import Entry, Style, Label, Labelframe

root = Tk()
style = Style()
style.theme_use('default')

style.configure('brown.TLabelframe', background='#C9B99B')
style.configure('brown.TLabelframe.Label', background='#EDEF77')
style.configure('brown.TLabel', background='#EDEF77')
style.configure('lowr.TLabel', background='lightblue')
style.configure('upr.TLabel', background='red')

LFTEXT = 'Beer Strength % v/v'
lf0 = Labelframe(root, text=LFTEXT, style='brown.TLabelframe')
lf0.pack(padx=10, pady=10)
L_LIMIT = 0.0
U_LIMIT = 10.0

ulab = Label(lf0, text=str(U_LIMIT) + "  upper limit", style='brown.TLabel')
ulab.grid(row=0, column=1, padx=10)
llab = Label(lf0, text=str(L_LIMIT) + "  lower limit", style='brown.TLabel')
llab.grid(row=2, column=1, padx=10)


def end_input(evt):
    """limit on float

    Parameters
    ----------
예제 #25
0
leftFrame.config(width=200, height=400, background="#eee")

rightFrame = Frame(win)
rightFrame.pack(side='right')
rightFrame.config(width=600, height=470, background="green")

panedwindow.add(leftFrame)
panedwindow.add(rightFrame)

bottomFrame = Frame(win)
bottomFrame.pack(side='bottom')
bottomFrame.config(width=800, height=30, background="blue")


# leftFrame에 Entry 위젯 추가
label_frame = Labelframe(leftFrame, text='기본 정보 입력')
label_frame.pack()

lbl_name = Label(label_frame, text="성명:")
lbl_phone = Label(label_frame, text="전화번호:")
lbl_email = Label(label_frame, text="이메일:")

entry_name = Entry(label_frame)
entry_phone = Entry(label_frame)
entry_email = Entry(label_frame)

lbl_name.grid(row=0, column=0)
entry_name.grid(row=0, column=1, padx=5, pady=5)
lbl_phone.grid(row=1, column=0)
entry_phone.grid(row=1, column=1, padx=5, pady=5)
lbl_email.grid(row=2, column=0)
예제 #26
0
    def start(self):
        """Called when initialised to create test widgets."""

        # Initialise timer variables to None. (no need to clear canvas yet!)
        self.vtimer = self.htimer = self.atimer = None

        Label(self,
              text="WARNING: The delta will contain x and y components, "
              "even if that function is only called on changes to one axis!\n"
              "WARNING 2: Smoothing not included").pack()

        # Horizontal movement

        horiz_frame = Labelframe(self, text="Horizontal")
        horiz_frame.pack(side="left", padx=10, pady=10)

        # Canvas for previewing delta movement.
        self.hcanvas = Canvas(horiz_frame, width=200, height=200)
        self.hcanvas.create_oval(110,
                                 110,
                                 90,
                                 90,
                                 fill=self.hcol,
                                 outline=self.hcol)
        self.hcanvas.pack()

        # Label for dragging from.
        l = Label(horiz_frame, text="DRAG ME", relief="ridge")
        l.pack(ipadx=10, ipady=10, padx=20, pady=20)

        # Create button to reset canvas.
        Button(horiz_frame,
               text="Reset",
               command=lambda: self.hcanvas.delete("delta")).pack(padx=3,
                                                                  pady=3)

        # Motion input (the actual thing being tested!)
        m = MotionInput(l)
        m.bind("<Motion-X>", self.on_horiz_mov)

        # Vertical movement

        vert_frame = Labelframe(self, text="Vertical")
        vert_frame.pack(side="left", padx=10, pady=10)

        # Canvas for previewing delta movement.
        self.vcanvas = Canvas(vert_frame, width=200, height=200)
        self.vcanvas.create_oval(110,
                                 110,
                                 90,
                                 90,
                                 fill=self.vcol,
                                 outline=self.vcol)
        self.vcanvas.pack()

        # Label for dragging from.
        l = Label(vert_frame, text="DRAG ME", relief="ridge")
        l.pack(ipadx=10, ipady=10, padx=20, pady=20)

        # Create button to reset canvas.
        Button(vert_frame,
               text="Reset",
               command=lambda: self.vcanvas.delete("delta")).pack(padx=3,
                                                                  pady=3)

        # Motion input (the actual thing being tested!)
        m = MotionInput(l)
        m.bind("<Motion-Y>", self.on_vert_mov)

        # Any movement

        any_frame = Labelframe(self, text="Any Direction")
        any_frame.pack(side="left", padx=10, pady=10)

        # Canvas for previewing delta movement.
        self.acanvas = Canvas(any_frame, width=200, height=200)
        self.acanvas.create_oval(110,
                                 110,
                                 90,
                                 90,
                                 fill=self.acol,
                                 outline=self.acol)
        self.acanvas.pack()

        # Label for dragging from.
        l = Label(any_frame, text="DRAG ME", relief="ridge")
        l.pack(ipadx=10, ipady=10, padx=20, pady=20)

        # Create button to reset canvas.
        Button(any_frame,
               text="Reset",
               command=lambda: self.acanvas.delete("delta")).pack(padx=3,
                                                                  pady=3)

        # Motion input (the actual thing being tested!)
        m = MotionInput(l)
        m.bind("<Motion-XY>", self.on_any_mov)
예제 #27
0
class Parameters_wind(object):  #Here y= row and x = column
    def __init__(self, master):
        self._rules = "RL"
        self._Game = []
        self._indice = 0
        frame = Frame(master)
        frame.grid()
        tabControl = ttk.Notebook(master)
        tabControl.configure(width=420, height=600)

        self.main_tab = ttk.Frame(tabControl)
        tabControl.add(self.main_tab, text="Settings")
        tabControl.grid()

        self.about_tab = ttk.Frame(tabControl)
        tabControl.add(self.about_tab, text="About")
        tabControl.grid()

        self.dimension = IntVar()
        self.dimension.set(value=50)
        self.chkValue = BooleanVar()
        self.chkValue.set(True)
        self.chkValue_two = BooleanVar()
        self.chkValue_two.set(False)
        self.nbr_of_ant = IntVar()
        self.nbr_of_ant.set(value=1)
        self.speed_opts = ['0', '1000', '500', '250', '100', '50', '10', '0']
        self.speed = StringVar()
        self.black_case_nbr = IntVar()
        self.black_case_nbr.set(value=0)

        self.about_page()
        self.main_page()

    def main_page(self):

        self.label_dimension = Label(
            self.main_tab, text="How many rows and columns do you want ?")
        self.label_dimension.grid(column=0, row=0, sticky='w')
        self.scale_dimension = Scale(self.main_tab,
                                     orient='horizontal',
                                     from_=25,
                                     to=200,
                                     variable=self.dimension,
                                     tickinterval=25,
                                     length=200)
        self.scale_dimension.grid(column=0, row=1, padx=5, pady=5)
        self.frame_dimension = Labelframe(self.main_tab,
                                          text="Order of ideas :",
                                          height=60,
                                          width=300)
        self.frame_dimension.grid(column=0, row=2, sticky='w')
        dimension_frame_label = [
            "<50 this is a bit small", "50<x<150 ideal dimension",
            ">150 quite such huge"
        ]
        for i in range(len(dimension_frame_label)):
            texte = dimension_frame_label[i]
            self.dimension_frame_label = Label(self.frame_dimension,
                                               text=f"{texte}")
            self.dimension_frame_label.grid(column=0, row=i, sticky='w')
        self.dimension_frame_label.grid(column=0, row=2, sticky='w')
        self.label_ant = Label(self.main_tab,
                               text="How many ant(s) do you want ?")
        self.label_ant.grid(column=0, row=3, sticky='w')
        self.scale_ant = Scale(self.main_tab,
                               orient='horizontal',
                               from_=1,
                               to=10,
                               variable=self.nbr_of_ant,
                               tickinterval=2,
                               length=200)
        self.scale_ant.grid(column=0, row=4, padx=5, pady=5)
        self.speed_label = Label(self.main_tab, text="Delay in millisecond :")
        self.speed_label.grid(column=0, row=5, sticky='w')
        self.speed_menu = OptionMenu(self.main_tab, self.speed,
                                     *self.speed_opts)
        self.speed_menu.grid(column=1, row=5, sticky='w')
        self.black_case_label = Label(self.main_tab,
                                      text="Percentage of black cells :")
        self.black_case_label.grid(column=0, row=6, sticky='w')
        self.black_case = Scale(self.main_tab,
                                orient='horizontal',
                                from_=0,
                                to=99,
                                variable=self.black_case_nbr,
                                tickinterval=10,
                                length=200)
        self.black_case.grid(column=0, row=7, padx=5, pady=5)

        self.frame_rules = Labelframe(self.main_tab,
                                      text="Rules setting:",
                                      height=100,
                                      width=400)
        self.frame_rules.grid(column=0, row=8, sticky='w')
        self.label_rules = Label(self.frame_rules,
                                 text="Rules :" + str(self._rules))
        self.label_rules.grid(column=0, row=0, sticky='w', columnspan=3)
        self.button_F = Button(self.frame_rules, text="F", command=self.F)
        self.button_F.grid(column=1, row=1, padx=5, pady=5)
        self.button_L = Button(self.frame_rules, text="L", command=self.L)
        self.button_L.grid(column=0, row=2, padx=5, pady=5)
        self.button_clean = Button(self.frame_rules,
                                   text="Clean",
                                   command=self.clean)
        self.button_clean.grid(column=1, row=2, padx=5, pady=5)
        self.button_R = Button(self.frame_rules, text="R", command=self.R)
        self.button_R.grid(column=2, row=2, padx=5, pady=5)
        self.button_B = Button(self.frame_rules, text="B", command=self.B)
        self.button_B.grid(column=1, row=3, padx=5, pady=5)

        self.chk = Checkbutton(self.main_tab, text='Grid', var=self.chkValue)
        self.chk.grid(column=0, row=9)
        self.chk_two = Checkbutton(self.main_tab,
                                   text='Desctructive collision',
                                   var=self.chkValue_two)
        self.chk_two.grid(column=1, row=9)
        self.button_simulator = Button(self.main_tab,
                                       text="Go to simulation auto",
                                       command=self.simulation_ants)
        self.button_simulator.grid(column=0, row=10)
        self.button_simulator_steps = Button(
            self.main_tab,
            text="Go to simulation step by step",
            command=self.simulation_steps)
        self.button_simulator_steps.grid(column=1, row=10, pady=15)

    def about_page(self):
        self.ligne = 0
        about_label = [
            "Students in the project :", "      -Esteban Mathia",
            "      -Victor Minne", "      -Tom Cleenewerck"
        ]
        for i in range(len(about_label)):
            texte = about_label[i]
            self.about_label = Label(self.about_tab, text=f"{texte}")
            self.about_label.grid(column=0, row=self.ligne, sticky='w')
            self.ligne += 1

        esteban = [
            "Esteban :", "   +33675549372", "   [email protected]"
        ]
        victor = ["Victor :", "   +33611815452", "   [email protected]"]
        tom = ["Tom :", "   +33750370032", "   [email protected]"]
        info_contribuator = [esteban, victor, tom]
        for i in range(len(info_contribuator)):
            for j in range(len(info_contribuator[i])):
                texte = info_contribuator[i][j]
                self.about_label = Label(self.about_tab, text=f"{texte}")
                self.about_label.grid(column=0, row=self.ligne, sticky='w')
                self.ligne += 1

    def F(self):
        if len(self._rules) < 12:
            self._rules += "F"
        else:
            messagebox.showinfo("Info", "You arrive to maximum rules")
        self.actu_rules()

    def L(self):
        if len(self._rules) < 12:
            self._rules += "L"
        else:
            messagebox.showinfo("Info", "You arrive to maximum rules")
        self.actu_rules()

    def R(self):
        if len(self._rules) < 12:
            self._rules += "R"
        else:
            messagebox.showinfo("Info", "You arrive to maximum rules")
        self.actu_rules()

    def B(self):
        if len(self._rules) < 12:
            self._rules += "B"
        else:
            messagebox.showinfo("Info", "You arrive to maximum rules")
        self.actu_rules()

    def clean(self):
        self._rules = ""
        self.actu_rules()

    def actu_rules(self):
        self.label_rules.config(text="Rules :" + str(self._rules))

    def simulation_ants(self):
        if len(self._rules) > 0:
            threading._start_new_thread(self.new_board, ())
            self._Game.append("")
            time.sleep(0.2)
            self._indice += 1
        else:
            messagebox.showwarning(
                "Warning", "The Rules are incorrect, please complete it")

    def new_board(self):
        row = self.dimension.get()
        column = self.dimension.get()
        number_of_ant = self.nbr_of_ant.get()
        speed = int(self.speed.get()) / 1000
        percentage = self.black_case_nbr.get()
        border = self.chkValue.get()
        collision = self.chkValue_two.get()
        self._Game[self._indice] = Board_multiple_ants(collision, self._rules,
                                                       border, self._indice,
                                                       row, column, percentage,
                                                       number_of_ant, speed)

    def simulation_steps(self):
        if len(self._rules) > 0:
            threading._start_new_thread(self.new_board_steps, ())
            self._Game.append("")
            time.sleep(0.2)
            self._indice += 1
        else:
            messagebox.showwarning(
                "Warning", "The Rules are incorrect, please complete it")

    def new_board_steps(self):
        row = self.dimension.get()
        column = self.dimension.get()
        number_of_ant = self.nbr_of_ant.get()
        percentage = self.black_case_nbr.get()
        border = self.chkValue.get()
        collision = self.chkValue_two.get()
        self._Game[self._indice] = Simulator_steps(collision, self._rules,
                                                   self._indice, row, column,
                                                   percentage, number_of_ant,
                                                   border)
예제 #28
0
"""entry for string with layout"""
from tkinter import Tk, StringVar
from tkinter.ttk import Entry, Style, Label, Labelframe

root = Tk()
style = Style()
style.theme_use('default')

LF_TEXT = 'Beer Type'
lf0 = Labelframe(root, text=LF_TEXT)
lf0.grid(column=0, row=0)


def end_input(evt):
    """limit on string

    Parameters
    ----------
    evt : str
        bind handle

    Returns
    -------
    None
    """
    print('evt', entsv.get())
    if len(entsv.get()) > 5:
        mess_lbl['text'] = "That's OK"
    else:
        mess_lbl['text'] = "Should be at least 6 characters long"
예제 #29
0
파일: main.py 프로젝트: MattStultz/Skylight
        
        config.set('exposureTime', parseInt(self.vExposureTime.get()))
        config.set('startingExposureTime', parseInt(self.vStartingExposureTime.get()))
        config.set('startingLayers', parseInt(self.vStartingLayers.get()))
        config.set('postPause', parseInt(self.vPostPause.get()))
        config.set('retractDistance', parseFloat(self.vRetractDistance.get()))
        config.set('retractSpeed', parseInt(self.vRetractSpeed.get()))
        config.set('returnSpeed', parseInt(self.vReturnSpeed.get()))
        config.set('prePause', parseInt(self.vPrePause.get()))

handler.bind('next-layer', printNextLayer)
handler.bind('start', printStarted)



fileFrame = Labelframe(root, text="File")
fileFrame.pack(expand=True, fill=X, anchor=N, side=TOP, padx = 10, pady = 10)
filenameLabel = Label(fileFrame, text="No file selected")
filenameLabel.pack(side=LEFT)
selectFileButton = Button(fileFrame, text = 'Select File', command = load_file)
selectFileButton.pack(side=RIGHT, padx=5)


bodyFrame = Frame(root, width = 600, height=400)
bodyFrame.pack(expand=True, fill=X, padx=10, anchor=W)

view3DFrame = Frame(width=300, height=300)
viewLayerFrame = LayerPreview(root, width=300, height=300)


viewFrame = Notebook(bodyFrame)
예제 #30
0
class MainView(Frame):
    def __init__(self, root, model: Model):
        super().__init__(root)
        root.columnconfigure(0, weight=1)
        root.rowconfigure(0, weight=1)
        self.model = model
        self.__init_components()
        self.grid(sticky='nsew')
        self.__bind_action_events()

    def __init_components(self):
        # Instanciar widgets
        self.panel_form = Labelframe(self, text='Tarea')
        self.panel_tasks = Labelframe(self, text='Tareas por hacer')
        self.panel_complete_tasks = Labelframe(self, text='Tareas completas')

        self.label_name = Label(self.panel_form, text='Nombre:')
        self.label_description = Label(self.panel_form, text='Descripción:')
        self.entry_name = Entry(self.panel_form)
        self.entry_description = Entry(self.panel_form)

        self.btn_modify_task = Button(self.panel_form,
                                      text='Editar tarea',
                                      state=DISABLED,
                                      command=self.__modify_task)
        self.btn_new_task = Button(self.panel_form,
                                   text='Nueva tarea',
                                   command=self.__new_task)
        self.btn_delete_task = Button(self.panel_form,
                                      text='Eliminar tarea',
                                      state=DISABLED,
                                      command=self.__delete_task)
        self.btn_clear_form = Button(self.panel_form,
                                     text='Limpiar campos',
                                     command=self.__clear_form)
        self.btn_complete_task = Button(self.panel_form,
                                        text='Completar tarea',
                                        state=DISABLED,
                                        command=self.__complete_task)

        self.scroll_tasks = Scrollbar(self.panel_tasks, orient=VERTICAL)
        self.scroll_complete_tasks = Scrollbar(self.panel_complete_tasks,
                                               orient=VERTICAL)
        self.list_tasks = Listbox(self.panel_tasks,
                                  selectmode=SINGLE,
                                  height=10,
                                  width=25,
                                  yscrollcommand=self.scroll_tasks.set)
        self.list_complete_tasks = Listbox(
            self.panel_complete_tasks,
            selectmode=SINGLE,
            height=10,
            width=25,
            yscrollcommand=self.scroll_complete_tasks.set)

        # Posicionar los widgets
        # Panel de formulario de tareas
        self.panel_form.pack(fill='both',
                             expand='yes',
                             padx=10,
                             pady=5,
                             ipadx=5,
                             ipady=5)
        self.panel_form.columnconfigure(0, weight=1)
        self.panel_form.rowconfigure(0, weight=1)

        self.label_name.grid(row=0, column=0, padx=5, sticky='w')
        self.entry_name.grid(row=0, column=1, padx=5, sticky='w')
        self.label_description.grid(row=1,
                                    column=0,
                                    padx=5,
                                    pady=5,
                                    sticky='w')
        self.entry_description.grid(row=1,
                                    column=1,
                                    padx=5,
                                    pady=10,
                                    sticky='w')

        # Botones
        self.btn_modify_task.grid(row=2, column=0, ipady=4, sticky='we')
        self.btn_new_task.grid(row=2, column=1, ipady=4, sticky='we')
        self.btn_delete_task.grid(row=3, column=0, ipady=4, sticky='we')
        self.btn_clear_form.grid(row=3, column=1, ipady=4, sticky='we')
        self.btn_complete_task.grid(row=4,
                                    column=0,
                                    columnspan=2,
                                    ipady=4,
                                    sticky='we')

        config_list = {
            'fill': 'both',
            'expand': 'yes',
            'padx': 10,
            'pady': 5,
            'ipadx': 5,
            'ipady': 5
        }

        # Panel de lista de tareas pendientes
        self.panel_tasks.pack(config_list)
        self.panel_tasks.columnconfigure(0, weight=20)
        self.panel_tasks.columnconfigure(1, weight=1)
        self.list_tasks.grid(row=0, column=0, sticky='we')
        self.scroll_tasks.configure(command=self.list_tasks.yview)
        self.scroll_tasks.grid(row=0, column=1, sticky='ns')

        # Panel de lista de tareas completas
        self.panel_complete_tasks.pack(config_list)
        self.panel_complete_tasks.columnconfigure(0, weight=20)
        self.panel_complete_tasks.columnconfigure(1, weight=1)
        self.list_complete_tasks.grid(row=0, column=0, sticky='we')
        self.scroll_complete_tasks.configure(
            command=self.list_complete_tasks.yview)
        self.scroll_complete_tasks.grid(row=0, column=1, sticky='ns')

    def __bind_action_events(self):
        # self.btn_new_task.bind('<Button>', self.__new_task)
        # self.btn_modify_task.bind('<Button>', self.__modify_task)
        # self.btn_delete_task.bind('<Button>', self.__delete_task)
        # self.btn_complete_task.bind('<Button>', self.__complete_task)

        self.list_tasks.bind('<<ListboxSelect>>', self.__select_task)

    def __new_task(self):
        log_info('Botón {} pulsado'.format(
            self.btn_new_task.config('text')[-1]))

        name_value = self.entry_name.get()
        description_value = self.entry_description.get()

        if name_value:
            self.model.new_task(name_value, description_value)
            self.update_tables()
        else:
            messagebox.showwarning('AVISO', 'Complete el campo de nombre')

    def __modify_task(self):
        index = self.__selected_task()

        name_value = self.entry_name.get()
        description_value = self.entry_description.get()

        if index != -1:
            task = self.model.get_task(self.model.tasks[index].get_id())
            complete = self.model.modify_task(task.get_id(), name_value,
                                              description_value)

            if complete:
                messagebox.showinfo('Aviso',
                                    'Tarea: {} editada'.format(task.name))

        self.update_tables()

    def __delete_task(self):
        index = self.__selected_task()

        if index != -1:
            task = self.model.get_task(self.model.tasks[index].get_id())
            self.model.delete_task(task.get_id())
            self.update_tables()

    def __complete_task(self):
        index = self.__selected_task()

        if index != -1:
            task = self.model.get_task(self.model.tasks[index].get_id())
            task.close_todo()
            complete = self.model.modify_task(task.get_id(), task.name,
                                              task.description)

            if complete:
                messagebox.showinfo('Aviso',
                                    'Tarea: {} completa'.format(task.name))

        self.update_tables()

    def __clear_form(self):
        self.clear_form()
        self.__change_state_btn(DISABLED)

    def __select_task(self, event):
        self.clear_form()
        index = self.__selected_task()

        if index != -1:
            task = self.model.get_task(self.model.tasks[index].get_id())
            self.set_form(task)
            self.__change_state_btn(NORMAL)

    def __change_state_btn(self, state: str):
        self.btn_new_task.config(
            state=NORMAL if state == DISABLED else DISABLED)
        self.btn_delete_task.config(state=state)
        self.btn_modify_task.config(state=state)
        self.btn_complete_task.config(state=state)

    def __selected_task(self):
        try:
            return self.list_tasks.curselection()[0]
        except IndexError:
            self.__change_state_btn(DISABLED)
            self.list_complete_tasks.activate(-1)
            return -1

    def update_tables(self):
        log_info('Actualizando tablas')
        self.list_tasks.delete(0, END)
        self.list_complete_tasks.delete(0, END)

        for index in range(len(self.model.tasks)):
            self.list_tasks.insert(index, self.model.tasks[index].name)

        for index in range(len(self.model.complete_tasks)):
            self.list_complete_tasks.insert(
                index, self.model.complete_tasks[index].name)

    def clear_form(self):
        self.entry_name.delete(0, END)
        self.entry_description.delete(0, END)

    def set_form(self, task: Task):
        if task is not None:
            self.entry_name.insert(0, task.name)
            self.entry_description.insert(0, task.description)
        else:
            log_error('No se encontró la tarea seleccionada')
    def open_config_window(self):
        config_window = Toplevel(self)
        config_window.iconbitmap(r'data\app.ico')
        config_window.minsize(500, 350)

        config_frame = Labelframe(config_window)
        config_frame.config(text="App Configuration",
                            relief='groove',
                            borderwidth=5)
        config_frame.pack(expand=1, fill='both', padx=5, pady=5)

        offset_title = Label(config_frame)
        offset_title.config(text='Numbering offset (Default 0)')
        offset_title.pack(anchor='nw', padx=5, pady=5)

        offset_entry = Entry(config_frame)
        offset_entry.config(
            width=10,
            exportselection=0,
            validate='key',
            validatecommand=(offset_entry.register(validate_config_entry),
                             '%P'))
        offset_entry.pack(anchor='nw', padx=5, pady=5)

        battle_value_frame = Labelframe(config_frame)
        battle_value_frame.config(text='Battle weighting',
                                  relief='groove',
                                  borderwidth=5)
        battle_value_frame.pack(anchor='nw',
                                fill='both',
                                expand=1,
                                padx=5,
                                pady=5)

        descriptor_frame = Frame(battle_value_frame)
        descriptor_frame.pack(side='left', fill='both', expand=1)

        entry_frame = Frame(battle_value_frame)
        entry_frame.pack(side='left', fill='both', expand=1)

        skirmish_title = Label(descriptor_frame)
        skirmish_title.config(text='Skirmish weighting (Default = 1):')
        skirmish_title.pack(anchor='nw', padx=5, pady=7)

        skirmish_entry = Entry(entry_frame)
        skirmish_entry.config(
            width=10,
            exportselection=0,
            validate='key',
            validatecommand=(skirmish_entry.register(validate_config_entry),
                             '%P'))
        skirmish_entry.pack(anchor='nw', padx=5, pady=5)

        advance_title = Label(descriptor_frame)
        advance_title.config(text='Advance weighting (Default = 1):')
        advance_title.pack(anchor='nw', padx=5, pady=10)

        advance_entry = Entry(entry_frame)
        advance_entry.config(
            width=10,
            exportselection=0,
            validate='key',
            validatecommand=(advance_entry.register(validate_config_entry),
                             '%P'))
        advance_entry.pack(anchor='nw', padx=5, pady=5)

        clan_war_title = Label(descriptor_frame)
        clan_war_title.config(text='Clan War weighting (Default = 3):')
        clan_war_title.pack(anchor='nw', padx=5, pady=6)

        clan_war_entry = Entry(entry_frame)
        clan_war_entry.config(
            width=10,
            exportselection=0,
            validate='key',
            validatecommand=(clan_war_entry.register(validate_config_entry),
                             '%P'))
        clan_war_entry.pack(anchor='nw', padx=5, pady=5)

        buttons_frame = Frame(config_frame)
        buttons_frame.pack(anchor='sw', fill='both', expand=0)

        apply_button = Button(buttons_frame)
        apply_button.config(text='Apply',
                            command=partial(self.config_apply, offset_entry,
                                            skirmish_entry, advance_entry,
                                            clan_war_entry))
        apply_button.pack(side='right', padx=5, pady=5)

        cancel_button = Button(buttons_frame)
        cancel_button.config(text='Cancel',
                             command=lambda: config_window.destroy())
        cancel_button.pack(side='right', padx=5, pady=5)

        ok_button = Button(buttons_frame)
        ok_button.config(text='OK',
                         style='OK.TButton',
                         command=partial(self.config_ok, offset_entry,
                                         skirmish_entry, advance_entry,
                                         clan_war_entry, config_window))
        ok_button.pack(side='right', padx=5, pady=5)

        offset_entry.insert('end', self.offset)
        skirmish_entry.insert('end', self.skirmish_value)
        advance_entry.insert('end', self.advance_value)
        clan_war_entry.insert('end', self.clan_war_value)
예제 #32
0
    def __init__(self, collision, rules, indice, row, col, percentage,
                 number_of_ant, border):
        self.rules = rules
        self.label_one_var = StringVar()
        self.label_two_var = StringVar()
        self.col = col
        self._win_ant = Tk()
        self._steps = 0
        self.indice = indice
        self._win_ant.title(
            f"Langton's ant simulation {indice} step {self._steps}")
        self._win_ant.geometry("1000x800")
        self._win_ant.resizable(False, True)
        self._screen_size = 800
        self._game = Board_steps(collision, rules, row, col, percentage,
                                 number_of_ant)
        self._board_real, self.coordonate_of_ants, self._steps = self._game.returnn(
        )
        number_of_ant, number_of_cell = self._game.info()
        self.dimension = IntVar()
        self.dimension.set(value=50)
        #The table stores the objects displayed on the screen
        self._board = [[0] * col for _ in range(0, row)]

        #The size of a cell in pixels
        self._px = self._screen_size // col
        self._py = self._screen_size // row
        #The canvas is created from the previous values
        self._frame_dimension = Labelframe(self._win_ant,
                                           text="Simulation :",
                                           height=60,
                                           width=300)
        self._frame_dimension.grid(column=0,
                                   columnspan=4,
                                   row=0,
                                   rowspan=2,
                                   sticky='w')
        self._monCanvas = Canvas(self._frame_dimension,
                                 width=self._screen_size,
                                 height=self._screen_size,
                                 bg='ivory')
        self._monCanvas.pack()

        if border:
            for y in range(0, row):
                for x in range(0, col):
                    self._board[y][x] = self._monCanvas.create_rectangle(
                        x * self._px,
                        y * self._py,
                        x * self._px + self._px,
                        y * self._py + self._py,
                        fill='white',
                        outline='black')
        else:
            for y in range(0, row):
                for x in range(0, col):
                    self._board[y][x] = self._monCanvas.create_rectangle(
                        x * self._px,
                        y * self._py,
                        x * self._px + self._px,
                        y * self._py + self._py,
                        fill='white',
                        outline='white')

        self._board_real, self.coordonate_of_ants, self._steps = self._game.returnn(
        )

        for i in range(len(self._board_real)):
            for j in range(len(self._board_real[0])):
                k = self._board_real[i][j]
                self._monCanvas.itemconfig(self._board[i][j], fill=k)

        for i in range(len(self.coordonate_of_ants)):
            self._monCanvas.itemconfig(
                self._board[self.coordonate_of_ants[i][0][0]][
                    self.coordonate_of_ants[i][0][1]],
                fill='grey')

        self._frame_button = Labelframe(self._win_ant,
                                        text="Steps settings :",
                                        height=60,
                                        width=300)
        self._frame_button.grid(column=5, row=0, sticky='w')
        self.scale_dimension = Scale(self._frame_button,
                                     orient='horizontal',
                                     from_=1,
                                     to=1000,
                                     variable=self.dimension,
                                     tickinterval=249,
                                     length=175)
        self.scale_dimension.grid(column=0, row=0, padx=5, pady=5)
        self.button_simulator_steps = Button(self._frame_button,
                                             text="Go forward",
                                             command=self.steps)
        self.button_simulator_steps.grid(column=0, row=1, pady=15)
        self.button_simulator_steps = Button(self._frame_button,
                                             text="Go backward",
                                             command=self.bsteps)
        self.button_simulator_steps.grid(column=0, row=2, pady=15)
        self.button_simulator_steps = Button(self._frame_button,
                                             text="Clear",
                                             command=self.clear)
        self.button_simulator_steps.grid(column=0, row=3, pady=15)
        self._monCanvas.bind("<ButtonPress-1>", self.mouseClick)
        self._frame_info = Labelframe(self._win_ant,
                                      text="Info :",
                                      height=60,
                                      width=300)
        self._frame_info.grid(column=5, row=1, sticky='w')
        if number_of_cell == 0 or number_of_cell == 1:
            self.label_one = Label(self._frame_info,
                                   text="Number of cell: " +
                                   str(number_of_cell))
            self.label_one.grid(column=0, row=0, sticky='w')
        else:
            self.label_one = Label(self._frame_info,
                                   text="Number of cells: " +
                                   str(number_of_cell))
            self.label_one.grid(column=0, row=0, sticky='w')

        if number_of_ant[1] == 0 or number_of_ant[1] == 1:
            self.label_two = Label(self._frame_info,
                                   text="Number of ant alive: " +
                                   str(number_of_ant[1]))
            self.label_two.grid(column=0, row=1, sticky='w')
        else:
            self.label_two = Label(self._frame_info,
                                   text="Number of ants alive: " +
                                   str(number_of_ant[1]))
            self.label_two.grid(column=0, row=1, sticky='w')

        if number_of_ant[0] == 0 or number_of_ant[0] == 1:
            self.label_three = Label(self._frame_info,
                                     text="Number of ant dead: " +
                                     str(number_of_ant[0]))
            self.label_three.grid(column=0, row=2, sticky='w')
        else:
            self.label_three = Label(self._frame_info,
                                     text="Number of ants dead: " +
                                     str(number_of_ant[0]))
            self.label_three.grid(column=0, row=2, sticky='w')

        self._win_ant.mainloop()
예제 #33
0
    def __init__(self, parent, txt=dict()):
        """Instanciating the output workbook."""
        self.parent = parent
        Frame.__init__(self)

        # subframe
        self.FrDb = Labelframe(self,
                               name="database",
                               text=txt.get("gui_fr2", "SGBD"))

        # DB variables
        self.opt_pgvw = IntVar(self.FrDb)  # able/disable PostGIS views
        self.host = StringVar(self.FrDb, "localhost")
        self.port = IntVar(self.FrDb, 5432)
        self.dbnb = StringVar(self.FrDb)
        self.user = StringVar(self.FrDb, "postgres")
        self.pswd = StringVar(self.FrDb)

        # Form widgets
        self.ent_H = Entry(self.FrDb, textvariable=self.host)
        self.ent_P = Entry(self.FrDb, textvariable=self.port, width=5)
        self.ent_D = Entry(self.FrDb, textvariable=self.dbnb)
        self.ent_U = Entry(self.FrDb, textvariable=self.user)
        self.ent_M = Entry(self.FrDb, textvariable=self.pswd, show="*")

        caz_pgvw = Checkbutton(
            self.FrDb,
            text=txt.get("gui_views", "Views enabled"),
            variable=self.opt_pgvw,
        )

        # Label widgets
        self.lb_H = Label(self.FrDb, text=txt.get("gui_host", "Host"))
        self.lb_P = Label(self.FrDb, text=txt.get("gui_port", "Port"))
        self.lb_D = Label(self.FrDb, text=txt.get("gui_db", "Database"))
        self.lb_U = Label(self.FrDb, text=txt.get("gui_user", "User"))
        self.lb_M = Label(self.FrDb, text=txt.get("gui_mdp", "Password"))
        # widgets placement
        self.ent_H.grid(row=1,
                        column=1,
                        columnspan=2,
                        sticky="NSEW",
                        padx=2,
                        pady=2)
        self.ent_P.grid(row=1,
                        column=3,
                        columnspan=1,
                        sticky="NSE",
                        padx=2,
                        pady=2)
        self.ent_D.grid(row=2,
                        column=1,
                        columnspan=1,
                        sticky="NSEW",
                        padx=2,
                        pady=2)
        self.ent_U.grid(row=2,
                        column=3,
                        columnspan=1,
                        sticky="NSEW",
                        padx=2,
                        pady=2)
        self.ent_M.grid(row=3,
                        column=1,
                        columnspan=3,
                        sticky="NSEW",
                        padx=2,
                        pady=2)
        self.lb_H.grid(row=1, column=0, sticky="NSEW", padx=2, pady=2)
        self.lb_P.grid(row=1, column=3, sticky="NSW", padx=2, pady=2)
        self.lb_D.grid(row=2, column=0, sticky="NSW", padx=2, pady=2)
        self.lb_U.grid(row=2, column=2, sticky="NSW", padx=2, pady=2)
        self.lb_M.grid(row=3, column=0, sticky="NSWE", padx=2, pady=2)
        caz_pgvw.grid(row=4, column=0, sticky="NSWE", padx=2, pady=2)

        # frame position
        self.FrDb.grid(row=3, column=1, sticky="NSWE", padx=2, pady=2)
예제 #34
0
    def main_page(self):

        self.label_dimension = Label(
            self.main_tab, text="How many rows and columns do you want ?")
        self.label_dimension.grid(column=0, row=0, sticky='w')
        self.scale_dimension = Scale(self.main_tab,
                                     orient='horizontal',
                                     from_=25,
                                     to=200,
                                     variable=self.dimension,
                                     tickinterval=25,
                                     length=200)
        self.scale_dimension.grid(column=0, row=1, padx=5, pady=5)
        self.frame_dimension = Labelframe(self.main_tab,
                                          text="Order of ideas :",
                                          height=60,
                                          width=300)
        self.frame_dimension.grid(column=0, row=2, sticky='w')
        dimension_frame_label = [
            "<50 this is a bit small", "50<x<150 ideal dimension",
            ">150 quite such huge"
        ]
        for i in range(len(dimension_frame_label)):
            texte = dimension_frame_label[i]
            self.dimension_frame_label = Label(self.frame_dimension,
                                               text=f"{texte}")
            self.dimension_frame_label.grid(column=0, row=i, sticky='w')
        self.dimension_frame_label.grid(column=0, row=2, sticky='w')
        self.label_ant = Label(self.main_tab,
                               text="How many ant(s) do you want ?")
        self.label_ant.grid(column=0, row=3, sticky='w')
        self.scale_ant = Scale(self.main_tab,
                               orient='horizontal',
                               from_=1,
                               to=10,
                               variable=self.nbr_of_ant,
                               tickinterval=2,
                               length=200)
        self.scale_ant.grid(column=0, row=4, padx=5, pady=5)
        self.speed_label = Label(self.main_tab, text="Delay in millisecond :")
        self.speed_label.grid(column=0, row=5, sticky='w')
        self.speed_menu = OptionMenu(self.main_tab, self.speed,
                                     *self.speed_opts)
        self.speed_menu.grid(column=1, row=5, sticky='w')
        self.black_case_label = Label(self.main_tab,
                                      text="Percentage of black cells :")
        self.black_case_label.grid(column=0, row=6, sticky='w')
        self.black_case = Scale(self.main_tab,
                                orient='horizontal',
                                from_=0,
                                to=99,
                                variable=self.black_case_nbr,
                                tickinterval=10,
                                length=200)
        self.black_case.grid(column=0, row=7, padx=5, pady=5)

        self.frame_rules = Labelframe(self.main_tab,
                                      text="Rules setting:",
                                      height=100,
                                      width=400)
        self.frame_rules.grid(column=0, row=8, sticky='w')
        self.label_rules = Label(self.frame_rules,
                                 text="Rules :" + str(self._rules))
        self.label_rules.grid(column=0, row=0, sticky='w', columnspan=3)
        self.button_F = Button(self.frame_rules, text="F", command=self.F)
        self.button_F.grid(column=1, row=1, padx=5, pady=5)
        self.button_L = Button(self.frame_rules, text="L", command=self.L)
        self.button_L.grid(column=0, row=2, padx=5, pady=5)
        self.button_clean = Button(self.frame_rules,
                                   text="Clean",
                                   command=self.clean)
        self.button_clean.grid(column=1, row=2, padx=5, pady=5)
        self.button_R = Button(self.frame_rules, text="R", command=self.R)
        self.button_R.grid(column=2, row=2, padx=5, pady=5)
        self.button_B = Button(self.frame_rules, text="B", command=self.B)
        self.button_B.grid(column=1, row=3, padx=5, pady=5)

        self.chk = Checkbutton(self.main_tab, text='Grid', var=self.chkValue)
        self.chk.grid(column=0, row=9)
        self.chk_two = Checkbutton(self.main_tab,
                                   text='Desctructive collision',
                                   var=self.chkValue_two)
        self.chk_two.grid(column=1, row=9)
        self.button_simulator = Button(self.main_tab,
                                       text="Go to simulation auto",
                                       command=self.simulation_ants)
        self.button_simulator.grid(column=0, row=10)
        self.button_simulator_steps = Button(
            self.main_tab,
            text="Go to simulation step by step",
            command=self.simulation_steps)
        self.button_simulator_steps.grid(column=1, row=10, pady=15)
예제 #35
0
파일: Window.py 프로젝트: TSPcoder/PysThon
    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)

        self.constraints = []
        self.gf = None
        self.solver = None
        self.table = None

        # Left of the GUI
        self.frameLeft = Frame(self, borderwidth=0, relief=GROOVE)
        self.frameLeft.pack(side="left")

        frameTop = Frame(self.frameLeft, borderwidth=0, relief=GROOVE)
        frameTop.pack(side="top")

        frameModification = Labelframe(frameTop, borderwidth=0, relief=GROOVE,text="Modification de la Contrainte")
        Label(frameModification, text='Nom de la contrainte').grid(row=1, column=1, columnspan=2, padx=10, pady=5)
        Label(frameModification, text='Affichage constrainte').grid(row=2, column=1, columnspan=2, padx=10, pady=5)
        m = Button(frameModification, text='Modifier')
        m.grid(row=3, column=1, columnspan=2, padx=10, pady=5)
        m.bind('<Button-1>', self.buttonModifier)
        Button(frameModification, text='Supprimer').grid(row=7, column=1, columnspan=2, padx=10, pady=5)
        frameModification.pack(side="left", padx=5, pady=5)

        # Bottom of the GUI
        self.frameBottom = Frame(self.frameLeft, borderwidth=0, relief=GROOVE)
        self.frameBottom.pack(side="top")

        frameButtons = Frame(self.frameBottom, borderwidth=0, relief=GROOVE)
        solve = Button(frameButtons, text='Lancer la résolution')
        solve.pack(side="bottom", padx=5, pady=5)
        solve.bind('<Button-1>', self.solve)

        f = Button(frameButtons, text='Fonction objectif')
        f.bind('<Button-1>', self.buttonGF)
        f.pack(side="bottom", padx=5, pady=5)

        b = Button(frameButtons, text='Ajouter une Contrainte')
        b.pack(side="bottom", padx=5, pady=5)

        frameButtons.pack(side="left", padx=0, pady=0)

        frameConstraints = Labelframe(self.frameBottom, borderwidth=0, relief=GROOVE, text="Constraintes")
        self.listConstraints = Listbox(frameConstraints)
        self.listConstraints.pack()
        frameConstraints.pack(side="left", padx=5, pady=5)

        frameResults = Labelframe(self.frameLeft, borderwidth=0, relief=GROOVE, text="Résultat")
        labelResults = Label(frameResults, text="Résultats", bg="white")
        labelResults.pack()
        frameResults.pack(side="top", padx=5, pady=5)

        frameTable = LabelFrame(self.frameLeft, borderwidth=0, relief=GROOVE, text="Tableau")
        for ligne in range(5):
            for colonne in range(5):
                Label(frameTable, text='L%s-C%s' % (ligne, colonne), relief=GROOVE, borderwidth=5).grid(row=ligne,
                                                                                                        column=colonne)

        frameTable.pack(side="top", padx=5, pady=5)

        # Tkinter loop
        self.mainloop()