def initUI(self): self.master.title("QS") self.pack(fill=BOTH, expand=True) # Mad ghetto code. Needs to be fixed. self.columnconfigure(0, weight=10) self.columnconfigure(1, weight=10) self.columnconfigure(2, weight=2) self.columnconfigure(3, weight=2) self.columnconfigure(4, weight=2) self.columnconfigure(5, weight=2) self.columnconfigure(6, weight=2) self.columnconfigure(7, weight=2) self.columnconfigure(8, weight=2) self.subject_label = Label(self, text="Choose a subject") self.subject_label.grid(row=0, column=0, padx=(20, 0), pady=(20, 0), sticky="we") # Subject dropdown menu subjects_options = [key for key in subjects_to_id] self.current_subject = subjects_options[0] self.poll_thread = Thread(target=self.poll_queue, args=()) self.poll_thread.start() # Value used in the dropdown self.var = StringVar(self) self.var.set(subjects_options[0]) # Dropdown box. Could potentially used a combobox, idk. But this works I guess. self.subject_dropdown = OptionMenu(self, self.var, *subjects_options, command=self.on_subject_change) self.subject_dropdown.config(width=len(max(subjects_options, key=len))) self.subject_dropdown.grid(row=1, column=0, padx=(20, 0), pady=(0, 20), sticky="ew", columnspan=2) # Text with info about how many people there are in the queue. self.queue_label_text = StringVar(self) self.queue_label_text.set("People in queue: 0") # Label with text containing the number of people in the queue. self.queue_label = Label(self, textvariable=self.queue_label_text) self.queue_label.grid(row=2, column=0, sticky="w", padx=(20, 0)) # Listbox with everyone in the queue. self.queue_listbox = Listbox(self) self.queue_listbox.bind( "<<ListboxSelect>>", func=self.selected_item ) # Runs the selected_item function every time a item is selected. self.queue_listbox.config(width=24) self.queue_listbox.grid(row=3, column=0, padx=(20, 20), columnspan=2, rowspan=5, sticky="nsew") self.random_add_button = Button(self, text="Add Random", command=self.add_random_student) self.random_add_button.grid(row=8, column=0, sticky="ew", padx=(20, 0)) self.delete_button = Button(self, text="Delete", command=self.delete_student) self.delete_button.grid(row=8, column=1, sticky="ew") self.boost_button = Button(self, text="Boost", command=self.boost_student) self.boost_button.grid(row=9, column=0, sticky="ew", padx=(20, 0)) self.derank_button = Button(self, text="Derank", command=self.derank_student) self.derank_button.grid(row=9, column=1, sticky="ew") self.exercises_var = StringVar(self) self.exercises_var.set("Exercises chosen: (None)") self.exercises_label = Label(self, textvariable=self.exercises_var) self.exercises_label.grid(row=1, column=2, columnspan=self.columns) self.room_label = Label(self, text="Room") self.room_label.grid(row=8, column=2, columnspan=self.columns) self.room_list = Combobox(self, values=[ "{} ({})".format(room["roomName"], room["roomNumber"]) for room in self.rooms ], width=44) self.room_list.bind("<<ComboboxSelected>>", self.on_room_select) self.room_list.grid(row=9, column=2, columnspan=self.columns) self.desk_label = Label(self, text="Desk") self.desk_label.grid(row=10, column=2, columnspan=self.columns) self.desk_list = Combobox(self, values=["1"]) self.desk_list.grid(row=11, column=2, columnspan=self.columns, sticky="N") self.add_to_queue_button = Button(self, text="Add to queue", command=self.add_to_queue) self.add_to_queue_button.grid(row=13, column=2, sticky="ew", pady=(20, 0), columnspan=self.columns) self.cancel_button = Button(self, text="Cancel", command=self.cancel_queue) self.cancel_button.grid(row=14, column=2, sticky="ew", pady=(5, 0), columnspan=self.columns) # Adding students list self.student_list = Listbox(self) self.student_list.bind("<<ListboxSelect>>", func=self.select_student_to_add) self.student_list.bind("<Double-Button-1>", func=self.add_student) self.student_list.config(width=40) self.student_list.grid(row=12, column=0, padx=(20, 0)) self.update_students() self.student_add_list = Listbox(self) self.student_add_list.bind("<<ListboxSelect>>", func=self.select_student_to_remove) self.student_add_list.bind("<Double-Button-1>", func=self.remove_student) self.student_add_list.config(width=40) self.student_add_list.grid(row=12, column=1) self.add_student_button = Button(self, text="Add", command=self.add_student) self.add_student_button.grid(row=13, column=0, pady=(10, 0)) self.remove_student_button = Button(self, text="Remove", command=self.remove_student) self.remove_student_button.grid(row=13, column=1, pady=(10, 0)) self.on_subject_change(subject=self.current_subject)
label.place(x=5, y=40) file_entry = Entry(root) file_entry.place(x=120, y=40) label = Label(root, text='Select the appropriate choice: ') label.place(x=5, y=70) rdbtn1 = Radiobutton(root, text='Encryption', value='E', variable=btn) rdbtn1.place(x=10, y=95) rdbtn2 = Radiobutton(root, text='Decryption', value='D', variable=btn) rdbtn2.place(x=125, y=95) label = Label(root, text='Select the type of encryption: ') label.place(x=5, y=125) data = ("1. Reverse Cipher Encryption", "2. Caesar Cipher Encryption", "3. ROT13 Cipher Encryption", "4. Transposition Cipher Encryption") cb = Combobox(root, values=data, width=30) cb.place(x=220, y=125) def execute(): fname = file_entry.get() s.send(bytes(fname, 'utf-8')) print("Filename is ", fname) f = open(fname) msg = f.readline() f.close() print("Message :", msg) pr = btn.get() print("Choice : ", pr)
parser.add_argument("-c", "--client_index", type=int, help="Client index, used in communication", required=True) parser.add_argument("-u", "--user_id", type=int, help="User ID", required=True) parser.add_argument("-i", "--index", type=int, help="Index of this photo sheet instance", required=True) args = parser.parse_args() window = Tk() window.title("Photo Sheet {0}".format(args.index)) print(os.getcwd()) photos_img = ImageTk.PhotoImage( Image.open("test_data/photo_sheet_{0}.png".format(args.index))) w = photos_img.width() h = photos_img.height() window.geometry('%dx%d+0+0' % (w, h)) background_label = Label(window, image=photos_img) background_label.place(x=0, y=0, relwidth=1, relheight=1) comboExample = Combobox(window, values=["1-8", "9-15", "16-23", "24-31", "32-40"]) comboExample.place(x=0, y=0) window.mainloop()
def new_entry(self): # sprawdzam czy mam wiecej niz 1 wpis i moge wyliczać stan licznikow count = Woda.fetchone(self) # pola do wpisywania danych data_odczytu = tk.Entry(self.frame2, width=5) data_odczytu.config(font=("Courier", 8)) data_odczytu.grid(row=5, column=1, padx=4, sticky='WE') rok = tk.Entry(self.frame2, width=5) rok.config(font=("Courier", 8)) rok.grid(row=5, column=2, padx=4, sticky='WE') choices = [ 'Grudzień/Styczeń', 'Luty/Marzec', 'Kwiecień/Maj', 'Czerwiec/Lipiec', 'Sierpień/Wrzesień', 'Październik/Listopad' ] # variable = StringVar(self.root) # # variable.set('Grudzień/Styczeń') miesiace = Combobox(self.frame2, width=5, values=choices) miesiace.current(0) miesiace.config(font=("Courier", 8)) miesiace.grid(row=5, column=3, padx=4, sticky='WE') ldom = tk.Entry(self.frame2, width=5) ldom.config(font=("Courier", 8)) ldom.grid(row=5, column=4, padx=4, sticky='WE') lgora = tk.Entry(self.frame2, width=5) lgora.config(font=("Courier", 8)) lgora.grid(row=5, column=5, padx=4, sticky='WE') lgabinet = tk.Entry(self.frame2, width=5) lgabinet.config(font=("Courier", 8)) lgabinet.grid(row=5, column=6, padx=4, sticky='WE') if count[0] == 0: self.gora = tk.Entry(self.frame2, width=5) self.gora.config(font=("Courier", 8)) self.gora.grid(row=5, column=7, padx=4, sticky='WE') self.gabinet = tk.Entry(self.frame2, width=5) self.gabinet.config(font=("Courier", 8)) self.gabinet.grid(row=5, column=8, padx=4, sticky='WE') self.dol = tk.Entry(self.frame2, width=5) self.dol.config(font=("Courier", 8)) self.dol.grid(row=5, column=9, padx=4, sticky='WE') self.dom = tk.Entry(self.frame2, width=5) self.dom.config(font=("Courier", 8)) self.dom.grid(row=5, column=10, padx=4, sticky='WE') confirm_button = Button( self.frame2, text="ZAPISZ", command=lambda: self.submit(data_odczytu, rok, miesiace, ldom, lgora, lgabinet)) else: confirm_button = Button( self.frame2, text="ZAPISZ", command=lambda: self.submit(data_odczytu, rok, miesiace, ldom, lgora, lgabinet)) confirm_button.grid(row=5, column=11) # modify entry modify_button = tk.Button(self.frame2, text='NR ID DO ZMIANY', width=14, command=lambda: self.change_entry('water')) modify_button.config(font=("Courier", 8)) modify_button.grid(row=18, column=1, sticky='WE', padx=4) self.modify_entry = tk.Entry(self.frame2, text='ZMIEŃ', width=6) self.modify_entry.config(font=("Courier", 8)) self.modify_entry.grid(row=18, column=0, sticky='WE', padx=4)
name_entry.place(x=180, y=150, height=35, width=300) price_lab = tk.Label(root, text="Sort by Price", font=("Courier New CYR", 9), height=2, width=10, bg="#FF8000") price_lab.place(x=500, y=150) frame2 = tk.Frame(root, bd=1, bg="blue") frame2.place(x=580, y=158, width=100) v = ["<3000", "<6000", "<8000", "<10000", "<12000"] price_var = tk.StringVar() ### price_combo = Combobox(frame2, values=v, height=40, textvariable=price_var) price_combo.set("<Select>") price_combo.pack() rating_lab = tk.Label(root, text="Sort by rating", font=("Courier New CYR", 9), height=2, width=10, bg="#FF8000") rating_lab.place(x=700, y=150) frame3 = tk.Frame(root, bd=1, bg="blue") frame3.place(x=780, y=158, width=100) v = list(range(1, 6))
print("liczba_probek_testowych = ", liczba_probek_testowych) def input_kNM(): global liczbaPodklas liczbaPodklas = combo3.get() liczbaPodklas = int(liczbaPodklas) print("liczbaPodklas = ", liczbaPodklas) przyciskImportujCSV = tk.Button(text=" Importuj polosowany CSV ", command=getCSV, bg='green', fg='white', font=('helvetica', 12, 'bold')) przyciskImportujCSV.grid(column=1, row=0) etykieta3=Label(okno, text=" Procent próbek treningowych: [%]", font=("Arial",12)) etykieta3.grid(column=0,row=1) combo2 = Combobox(okno) combo2['values']=(10,20,30,40,50,60,70,80,90) combo2.current(7) combo2.grid(column=1,row=1) przyciskWybierzTrening = tk.Button(text=" Zatwierdź ", command=input_trening, bg='green', fg='white', font=('helvetica', 12, 'bold')) przyciskWybierzTrening.grid(column=2, row=1) etykieta2=Label(okno, text=" Wartość k dla metody kNN: \t", font=("Arial",12)) etykieta2.grid(column=0,row=3) combo = Combobox(okno) combo['values']=(1,2,3,4,5,6,7,8) combo.current(2) combo.grid(column=1,row=3)
def __createCombo(self, y, data): self.combo = Combobox(self.window, values=data) #self.combo.place(x=500,y=y) return self.combo
A3 = Label(master, font=("Helvetica", 16), text="") A3.grid(row=3, column=2, columnspan=5, pady=20) valpan = partial(valpan, pannumber, A2, A3) B1 = Button(master, text='Validate PAN', command=valpan, font=("Helvetica", 12)) B1.grid(row=1, column=6, columnspan=2, pady=20) Q4 = Label(master, text='Please Enter your State code', font=("Helvetica", 16)) Q4.grid(row=4, column=0, columnspan=2, pady=20) A4 = Combobox(master, values=statecodes, font=("Helvetica", 16), textvariable=stcode) A4.grid(row=4, column=2, columnspan=5, pady=20) Q5 = Label(master, text='Is this first number in your state', font=("Helvetica", 16)) Q5.grid(row=5, column=0, columnspan=2, pady=20) A5 = Combobox(master, values=('FIRST', 'SECOND', 'THIRD'), font=("Helvetica", 16), textvariable=rank) A5.grid(row=5, column=2, columnspan=5, pady=20)
def __init__(self, master, app): super(CreateStructureWindow, self).__init__() self._frame = master self._frame.wm_title("Define structure properties") self._frame.geometry('1800x900') self._frame.grab_set() if __name__ == '__main__': self._initial_structure_obj = test.get_structure_calc_object() self._initial_calc_obj = test.get_structure_calc_object() self._section_list = [] self._section_objects = [] for section in hlp.helper_read_section_file( 'bulb_anglebar_tbar_flatbar.csv'): SecObj = Section(section) self._section_list = hlp.add_new_section( self._section_list, SecObj) self._section_objects.append(SecObj) # m = self._ent_section_list.children['menu'] # m.add_command(label=SecObj.__str__(), command=self.section_choose) self._clicked_button = [ "long stf", "ring stf", "ring frame", "flat long stf", 'flat stf', 'flat girder' ][0] else: self.app = app self._clicked_button = app._clicked_section_create # if app._line_is_active else None try: if self._clicked_button in ['flat stf', "flat long stf"]: self._initial_structure_obj = self.app._line_to_struc[ app._active_line][0].Stiffener elif self._clicked_button == 'flat girder': self._initial_structure_obj = self.app._line_to_struc[ app._active_line][5].Girder elif self._clicked_button in ["long stf"]: self._initial_structure_obj = self.app._line_to_struc[ app._active_line][5].LongStfObj elif self._clicked_button == "ring stf": self._initial_structure_obj = self.app._line_to_struc[ app._active_line][5].RingStfObj elif self._clicked_button == "ring frame": self._initial_structure_obj = self.app._line_to_struc[ app._active_line][0].RingFrameObj else: self._initial_structure_obj = None except (KeyError, AttributeError) as error: self._initial_structure_obj = None self._section_list = [ section.__str__() for section in app._sections ] self._section_objects = app._sections image_dir = os.path.dirname(__file__) + '\\images\\' self._opt_runned = False self._opt_resutls = () self._draw_scale = 0.5 self._canvas_dim = (500, 450) ent_w = 10 start_x, start_y, dx, dy = 20, 70, 60, 33 self._canvas_struc = tk.Canvas(self._frame, width=self._canvas_dim[0], height=self._canvas_dim[1], background='azure', relief='groove', borderwidth=2) self.structure_types = ['T', 'L', 'L-bulb', 'FB'] self._canvas_struc.place(x=10, y=440) tk.Label(self._frame, text='-- Define structure properties here --', font='Verdana 15 bold').place(x=10, y=10) # # ### Adding matplotlib # fig, ax = run_section_properties()# Figure(figsize=(4, 4), dpi=100) # t = np.arange(0, 3, .01) # #fig.add_subplot(111).plot(t, 2 * np.sin(2 * np.pi * t)) # # canvas = FigureCanvasTkAgg(fig, master=master) # A tk.DrawingArea. # canvas.draw() # canvas.get_tk_widget().place(x=start_x+17*dx, y=start_y+dy ) # # toolbar = NavigationToolbar2Tk(canvas, master) # toolbar.update() # canvas.get_tk_widget().place(x=start_x+17*dx, y=start_y+10*dy ) # # def on_key_press(event): # print("you pressed {}".format(event.key)) # key_press_handler(event, canvas, toolbar) # # canvas.mpl_connect("key_press_event", on_key_press) self._new_spacing = tk.DoubleVar() self._new_pl_thk = tk.DoubleVar() self._new_web_h = tk.DoubleVar() self._new_web_thk = tk.DoubleVar() self._new_fl_w = tk.DoubleVar() self._new_fl_thk = tk.DoubleVar() self._new_stiffener_type = tk.StringVar() self._new_stiffener_filter = tk.StringVar() self._new_stiffener_filter.set('No filter applied') self._new_girder_length = tk.DoubleVar() self._new_section = tk.StringVar() self._ent_section_list = Combobox(self._frame, values=self._section_list, textvariable=self._new_section, width=40) self._ent_section_list.bind("<<ComboboxSelected>>", self.section_choose) # self._ent_section_list = tk.OptionMenu(self._frame, self._new_section, command=self.section_choose, # *['',] if self._section_list == [] else self._section_list) self._ent_structure_options = tk.OptionMenu(self._frame, self._new_stiffener_type, command=self.option_choose, *self.structure_types) self._ent_filter_stf = tk.OptionMenu( self._frame, self._new_stiffener_filter, command=self.regen_option_menu, *['No filter applied', 'L-bulb', 'L', 'FB', 'T']) self._ent_spacing = tk.Entry(self._frame, textvariable=self._new_spacing, width=ent_w) self._ent_pl_thk = tk.Entry(self._frame, textvariable=self._new_pl_thk, width=ent_w) self._ent_web_h = tk.Entry(self._frame, textvariable=self._new_web_h, width=ent_w) self._ent_web_thk = tk.Entry(self._frame, textvariable=self._new_web_thk, width=ent_w) self._ent_fl_w = tk.Entry(self._frame, textvariable=self._new_fl_w, width=ent_w) self._ent_fl_thk = tk.Entry(self._frame, textvariable=self._new_fl_thk, width=ent_w) self._ent_girder_length = tk.Entry( self._frame, textvariable=self._new_girder_length, width=ent_w) tk.Label(self._frame, text='Stiffener type:', font='Verdana 9 bold').place(x=start_x, y=start_y) tk.Label(self._frame, text='Girder length (Lg)', font='Verdana 9 bold').place(x=start_x + 9 * dx, y=start_y + 15 * dy) tk.Label(self._frame, text='[m]', font='Verdana 9 bold').place(x=start_x + 14 * dx, y=start_y + 15 * dy) self._ent_girder_length.place(x=start_x + 12 * dx, y=start_y + 15 * dy) tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x + 3 * dx, y=start_y + dy) tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x + 3 * dx, y=start_y + 2 * dy) tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x + 3 * dx, y=start_y + 3 * dy) tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x + 3 * dx, y=start_y + 4 * dy) tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x + 3 * dx, y=start_y + 5 * dy) tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x + 3 * dx, y=start_y + 6 * dy) tk.Label(self._frame, text='Existing sections:', font='Verdana 9 bold').place(x=start_x + 4 * dx, y=start_y + 6 * dy) tk.Label(self._frame, text='filter ->', font='Verdana 9 bold').place(x=start_x + 4 * dx, y=start_y + 7 * dy) self._ent_section_list.place(x=start_x + 7 * dx, y=start_y + 6 * dy) self._ent_filter_stf.place(x=start_x + 5 * dx, y=start_y + 7 * dy) tk.Button(self._frame, text='Read section list from file', command=self.read_sections, font='Verdana 10 bold', bg='blue', fg='yellow').place(x=start_x + 12 * dx, y=start_y + 6 * dy) tk.Button(self._frame, text='Load built in sections', command=self.read_sections_built_in, font='Verdana 10 bold', bg='azure', fg='black').place(x=start_x + 12 * dx, y=start_y + 7 * dy) # setting default values init_dim, init_thk = 0.05, 0.002 if self._initial_structure_obj != None: self._new_stiffener_type.set( self._initial_structure_obj.get_stiffener_type()) self._new_spacing.set(self._initial_structure_obj.get_s() * 1000) self._new_pl_thk.set(self._initial_structure_obj.get_pl_thk() * 1000) self._new_web_h.set(self._initial_structure_obj.get_web_h() * 1000) self._new_web_thk.set(self._initial_structure_obj.get_web_thk() * 1000) self._new_fl_w.set(self._initial_structure_obj.get_fl_w() * 1000) self._new_fl_thk.set(self._initial_structure_obj.get_fl_thk() * 1000) else: self._new_spacing.set(0) self._new_pl_thk.set(0) self._new_web_h.set(0) self._new_web_thk.set(0) self._new_fl_w.set(0) self._new_fl_thk.set(0) self._new_girder_length.set(10) self._ent_structure_options.place(x=start_x + dx * 3, y=start_y) if self._new_spacing.get() != 0: tk.Label(self._frame, text='Spacing', font='Verdana 9').place(x=start_x, y=start_y + dy) self._ent_spacing.place(x=start_x + dx * 2, y=start_y + dy) if self._new_pl_thk.get() != 0: tk.Label(self._frame, text='Plate thk.', font='Verdana 9').place(x=start_x, y=start_y + 2 * dy) self._ent_pl_thk.place(x=start_x + dx * 2, y=start_y + 2 * dy) if self._new_web_h.get() != 0: tk.Label(self._frame, text='Web height', font='Verdana 9').place(x=start_x, y=start_y + 3 * dy) self._ent_web_h.place(x=start_x + dx * 2, y=start_y + 3 * dy) if self._new_web_thk.get() != 0: tk.Label(self._frame, text='Web thk.', font='Verdana 9').place(x=start_x, y=start_y + 4 * dy) self._ent_web_thk.place(x=start_x + dx * 2, y=start_y + 4 * dy) if self._new_fl_w.get() != 0: tk.Label(self._frame, text='Flange width', font='Verdana 9').place(x=start_x, y=start_y + 5 * dy) self._ent_fl_w.place(x=start_x + dx * 2, y=start_y + 5 * dy) if self._new_fl_thk.get() != 0: tk.Label(self._frame, text='Flange thk.', font='Verdana 9').place(x=start_x, y=start_y + 6 * dy) self._ent_fl_thk.place(x=start_x + dx * 2, y=start_y + 6 * dy) self._new_spacing.trace('w', self.draw_trace) self._new_pl_thk.trace('w', self.draw_trace) self._new_web_h.trace('w', self.draw_trace) self._new_web_thk.trace('w', self.draw_trace) self._new_fl_w.trace('w', self.draw_trace) self._new_fl_thk.trace('w', self.draw_trace) try: img_file_name = 'img_stiffened_plate_panel.gif' if os.path.isfile('images/' + img_file_name): file_path = 'images/' + img_file_name else: file_path = os.path.dirname( os.path.abspath(__file__)) + '/images/' + img_file_name photo = tk.PhotoImage(file=file_path) label = tk.Label(self._frame, image=photo) label.image = photo # keep a reference! label.place(x=550, y=610) except TclError: pass try: img_file_name = 'img_T_L_FB.gif' if os.path.isfile('images/' + img_file_name): file_path = 'images/' + img_file_name else: file_path = os.path.dirname( os.path.abspath(__file__)) + '/images/' + img_file_name photo_T_L_FB = tk.PhotoImage(file=file_path) label = tk.Label(self._frame, image=photo_T_L_FB) label.image = photo_T_L_FB # keep a reference! label.place(x=270, y=50) except TclError: pass # Close and save depending on input # "long stf", "ring stf", "ring frame", "flat long stf" if self._clicked_button is not None: self.close_and_save = tk.Button( self._frame, text='Click to return section data to ' + self._clicked_button, command=self.save_and_close, bg='green', font='Verdana 10 bold', fg='yellow') self.close_and_save.place(x=start_x + dx * 9, y=start_y + dy * 12) self.draw_properties()
recommendedSize.grid(row=3, padx=3, pady=2, sticky="e", columnspan=2) previewCheck.grid(row=4, padx=3, pady=2, sticky="e", columnspan=2) sizeLabel.grid(row=0, column=3, padx=3, pady=2, sticky=E) # ----- Font ----- lst = [] for i in range(8, 73, 2): lst.append(i) sizeStr = StringVar() resetButton = Button(frame2, text='Reset', command=reset) resetButton.grid(row=0, columnspan=2, padx=3, pady=2, sticky=E) fontSizeCombo = Combobox(frame2, value=lst, width=4, textvariable=sizeStr) fontSizeCombo.grid(row=0, column=4, padx=3, pady=2, sticky=E) # ----- Initialization ----- size.set(True) sizeStr.set(10) colorsVariable.set(1) previewVariable.set(True) # ----- Trace ----- topStr.trace("w", lambda name, index, mode: preview()) bottomStr.trace("w", lambda name, index, mode: preview()) sizeStr.trace("w", lambda name, index, mode: size_change()) root.mainloop()
def setup_widgets(self): # New Label new_label = Label(self, text="New Transaction", font=("Montserrat", 14, "bold")) # Item Type Label it_label = Label(self, text="Item Type\t\t: ", font=("Montserrat", 12)) # Item Type Combobox Style().configure("m.TCombobox", background="#32BF84") self.__it_combobox = Combobox(self, state="readonly", values=list( self.controller.products.keys()), font=("Montserrat", 14), style="m.TCombobox") # Quantity Label q_label = Label(self, text="Quantity\t\t: ", font=("Montserrat", 12)) # Quantity Entry self.__q_entry = Entry(self) # Confirm Button confirm_button = HoveredButton(self, text="Confirm", fg="#fff", bg="#32BF84", activebackground="#048243", command=self.on_confirm_button, font=("Montserrat", 14, "bold")) # Back Button btn_back = HoveredButton( self, text="Back", fg="#fff", bg="#343837", activebackground="#1E2120", command=lambda: self.controller.switch_frame("mainmenu"), font=("Montserrat", 14, "bold")) # # ~ Place each widgets into its position # # New Label new_label.place(x=15, y=20) # Item Type Label it_label.place(x=15, y=60) # Item Type Combobox self.__it_combobox.place(anchor="ne", width=250, height=35, x=465, y=60) # Quantity Label q_label.place(x=15, y=100) # Quantity Entry self.__q_entry.insert(0, 1) self.__q_entry.place(anchor="ne", width=250, height=35, x=465, y=100) # Confirm Button confirm_button.place(anchor="s", width=450, height=50, x=240, y=560) # Back Button btn_back.place(anchor="n", width=450, height=50, x=240, y=570)
def ui(self): root = Tk() # 窗口的标题 root.title('PopulationGenerator') # 创建大小和位置 width = root.winfo_screenwidth() height = root.winfo_screenheight() root_height = 400 root_wight = 1000 x_width = (width - root_wight) / 2 x_height = (height - root_height) / 2 root.geometry('%dx%d+%d+%d' % (root_wight, root_height, x_width, x_height)) self.host = StringVar() self.port = StringVar() tab_main = Notebook(root) tab_main.place(relx=0.02, rely=0.02, relwidth=0.887, relheight=0.876) tab1 = Frame(tab_main) tab1.place(x=0, y=30) tab_main.add(tab1, text='wiki') # 将第一页插入分页栏中 frameTop = Frame(tab1, pady=10) frameTop.pack() frameCenter = Frame(tab1, pady=10) frameCenter.pack() frameBottom = Frame(tab1, pady=10) frameBottom.pack() # 选择年份的 yearLabel = Label(frameTop, text='year:', font=12, pady=3, padx=5) yearLabel.grid(row=0, column=0) self.yearBox = Combobox(frameTop) self.yearBox['values'] = self.years self.yearBox.bind('<<ComboboxSelected>>', self.getState) self.yearBox.grid(row=0, column=1) # 选择州 stateLabel = Label(frameTop, text='state:', font=12, pady=3, padx=5) stateLabel.grid(row=0, column=2) self.stateBox = Combobox(frameTop) self.stateBox.grid(row=0, column=3) hostLabel = Label(frameTop, text='host:', font=12, pady=3, padx=5) hostLabel.grid(row=1, column=0) self.hostText = Entry(frameTop, textvariable=self.host) self.hostText.grid(row=1, column=1) portLabel = Label(frameTop, text='port:', font=12, pady=3, padx=5) portLabel.grid(row=1, column=2) self.portText = Entry(frameTop, textvariable=self.port) self.portText.grid(row=1, column=3) # 请求按钮 button = Button(frameBottom, text='generate', padx=30, pady=10, command=self.get_result) button.pack() # 显示数据结果 # self.text = Text(frameBottom, height=4) self.resultData = StringVar() self.text = Label(frameBottom, textvariable=self.resultData, height=4, bg='green', fg='white', width=50, font=15) self.text.pack() tab2 = Frame(tab_main) tab2.place(x=100, y=30) tab_main.add(tab2, text='life_server') frameTop2 = Frame(tab2, pady=10) frameTop2.pack() typeLabel = Label(frameTop2, text='type:', font=12, pady=3, padx=5) typeLabel.grid(row=0, column=0) self.typeValue = StringVar() typeEntry = Entry(frameTop2, textvariable=self.typeValue) typeEntry.grid(row=0, column=1) categoryLabel = Label(frameTop2, text='category:', font=12, pady=3, padx=5) categoryLabel.grid(row=1, column=0) self.categoryValue = StringVar() categoryEntry = Entry(frameTop2, textvariable=self.categoryValue) categoryEntry.grid(row=1, column=1) number_to_generateLabel = Label(frameTop2, text='number_to_generate:', font=12, pady=3, padx=5) number_to_generateLabel.grid(row=2, column=0) self.number_to_generateValue = StringVar() number_to_generateEntry = Entry( frameTop2, textvariable=self.number_to_generateValue) number_to_generateEntry.grid(row=2, column=1) frameBottom2 = Frame(tab2, pady=10) frameBottom2.pack() # 发送按钮 button2 = Button(frameBottom2, text='send', padx=30, pady=10, command=self.sendToLifeServer) button2.pack() self.tableData = Treeview(tab2) self.tableData['columns'] = [str(i + 1) for i in range(20)] for item in self.tableData['columns']: self.tableData.column(item, width=40) self.tableData.heading(item, text=item) self.tableData.pack() scrollbar = Scrollbar(tab2, orient='horizontal', command=self.tableData.xview) scrollbar.pack() self.tableData.configure(yscrollcommand=scrollbar.set) root.mainloop()
filemenu.add_command(label="Текущая конфигурация", command=showConfig) menubar.add_cascade(label="Файл", menu=filemenu) runbar = Menu(root) runmenu = Menu(runbar, tearoff=0) runmenu.add_command(label="Пауза", command=setPause) menubar.add_cascade(label="Бегущая строка", menu=runmenu) ticketFrame = Frame(root, width=200, height=400, bg='#ded', bd=2) ticketFrame.pack(side='bottom', fill='x', expand=True) label = Label(ticketFrame, text="Выберите станцию", bg='#ded') label.grid(row=1, column=1) cb = Combobox(ticketFrame, values=stations, height=80) cb.grid(row=1, column=2) btn = Button(ticketFrame, text="Рассчитать", command=calculate) btn.grid(row=1, column=3) root.config(menu=menubar) thread = Thread(target=clock) thread.start() thread = Thread(target=runRow) thread.start() root.mainloop()
else: hasList = True keyList = [stringKey(DECRYPT_KEY)] keyName = [""] for line in listFile.readlines(): if line[-2:] == ':\n': keyName.append(line[:-2]) elif line != '\n': keyList.append(line[:-1]) listFile.close() if hasSkf: listWidth = 46 else: listWidth = 56 keySelect = Combobox(keyInfo, width=listWidth, state='readonly', value=keyName) keySelect.bind("<<ComboboxSelected>>", selectKey) keySelect.current(0) keySelect.pack(side='left', anchor='e') optionLabel = Label(optionFrame, text="Select option:") optionLabel.pack(side='top', anchor='w') optionVar = StringVar() optionVar.set(tool) optionList = Listbox(optionFrame, listvariable=optionVar, height=len(command)) optionList.selection_set(0) title = Label(selectedFrame, text=tool[0], font=('Fixdsys 14 bold')) title.pack() option = setSceneUnpacker() optionList.bind('<ButtonRelease-1>', select)
def addEmp(): window = Tk() window.geometry("500x430") window.title("SURVEILLANCE PROGRAM") window.resizable(0, 0) window.config(bg='light blue') global entryid, entryName, entryPhone, entryEmail, entryaddress, entryDesignation def phonevalidate(user_phoneno): if user_phoneno.isdigit(): return True elif user_phoneno == "": return True else: return False def isValidEmail(user_email): if len(user_email) > 7: if (re.search('^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$', user_email)): return True return False else: return False def validateName(user_name): if user_name.isalpha(): return True elif user_name == "": return True else: return False def validateAllfeilds(): ''' elif entryEmail.get() != "": status = isValidEmail(entryEmail.get()) if status == True: labelpng = PhotoImage(file="C:\\Users\\Pragya.DESKTOP-3UL0L63\\PycharmProjects\\pythonProject\\Yes.png") label1 = Label(window, image=labelpng, justify='center', height=30, width=30) label1.place(x=450, y=140) else: messagebox.showinfo(message="Enter Correct Email Address") x = isValidEmail(entryEmail.get()) y = phonevalidate(entryPhone.get()) z = validateName(entryName.get()) if z==True and x==True and y==True and len(entryPhone.get())==10 and entryEmail.get()!="" and entryDesignation.get()!="" and entryaddress.get()!="": return True else: return False ''' status = isValidEmail(entryEmail.get()) if entryName.get() == "": messagebox.showwarning(message="Enter Correct Name") return False elif len(entryPhone.get()) != 10: messagebox.showinfo(message="Enter Correct Number!") return False elif status == False: messagebox.showinfo(message="Enter Correct Email!") return False elif len(entryaddress.get()) == 0: messagebox.showwarning(message="Enter Correct Address") return False elif len(entryDesignation.get()) == 0: messagebox.showwarning(message="Choose Correct Designation") return False else: return True # database connection conn = mysql.connector.connect(user='******', password='******', host='localhost', auth_plugin='mysql_native_password', database='surveillance') cursor = conn.cursor() #labels label_title = Label(window, text="NEW EMPLOYEE DETAILS", fg='black', bg='light blue', font=('Times New Roman', 20,'bold','underline')).place(x=80, y=1) label_id = Label(window, text="Employee ID", fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=60, y=60) label_name = Label(window, text="Employee Name", fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=60, y=100) label_phone = Label(window, text="Employee Phone", fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=60, y=140) label_email = Label(window, text="Employee Email", fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=60, y=180) label_Address = Label(window, text="Employee Address", fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=60, y=220) label_designation = Label(window, text="Employee Designation", fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=60, y=260) label_image = Label(window, text="Employee Image", fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=60, y=300) #entries #entryid = Entry(window, fg='black', bg='light blue',font=('Times New Roman', 12, 'bold'), relief='sunken') #entryid.place(x=260, y=60) cursor.execute("select * from employee") cursor.fetchall() conn.commit() a = cursor.rowcount a = 100+a labelid = Label(window, text=a, fg='black', bg='light blue', font=('Times New Roman', 14)).place(x=260, y=60) entryName = Entry(window, fg='black', bg='light blue',font=('Times New Roman', 12, 'bold'), relief='sunken') entryName.place(x=260, y=100) valid_name = window.register(validateName) entryName.config(validate="key", validatecommand=(valid_name, '%P')) entryPhone = Entry(window, fg='black', bg='light blue',font=('Times New Roman', 12, 'bold'), relief='sunken') entryPhone.place(x=260, y=140) valid_phoneno = window.register(phonevalidate) entryPhone.config(validate="key", validatecommand=(valid_phoneno, '%P')) entryEmail = Entry(window, fg='black', bg='light blue',font=('Times New Roman', 12, 'bold'), relief='sunken') entryEmail.place(x=260, y=180) entryaddress = Entry(window, fg='black', bg='light blue',font=('Times New Roman', 12, 'bold'), relief='sunken') entryaddress.place(x=260, y=220) #entryDesignation = Entry(window, fg='black', bg='light blue',font=('Times New Roman', 12, 'bold'), relief='sunken') entryDesignation = Combobox(window, width=24,font=('Times New Roman', 12, 'bold')) entryDesignation['values'] = ('Software Developer', 'Team Leader', 'Manager', 'Graphic Designer', 'Sweeper', 'Assisstant' ,'Director', 'CEO', 'Floor Manager') entryDesignation.place(x=260, y=260) #camera function def click(): global x,y d = 0 x = str(a) y = entryName.get() #camera = cv2.VideoCapture(0) for i in range(8): camera = cv2.VideoCapture(0) return_value, image = camera.read() cv2.imwrite('./known/' +x+" "+y+str(i) + '.png', image) del (camera) messagebox.showinfo(message="PHOTOS CLICKED") def upload(): if validateAllfeilds() : global a1, a2, a3, a4, a5, a6 a2 = entryName.get() a3 = entryPhone.get() a4 = entryEmail.get() a5 = entryaddress.get() a6 = entryDesignation.get() print(len(a6), len(a5)) cursor.execute("insert into employee(empid,empname,phone,email,address,designation)values(%s,%s,%s,%s,%s,%s)", (a, a2, a3, a4, a5, a6)) conn.commit() messagebox.showinfo(title="ADD NEW EMPLOYEE", message="EMPLOYEE ADDED") window.destroy() #button buttonCamera = Button(window, text='Open Camera', justify='center', fg='black', bg='light blue', font=('Times New Roman', 12, 'italic'), relief='raised', command=click).place(x=260, y=300) buttonSubmit = Button(window, text=' SUBMIT ', justify='center', fg='black', bg='light blue', font=('Times New Roman', 14, 'bold'), relief='raised', command=upload).place(x=200, y=360) window.mainloop()
def _create_descrip_tab(self, nb): # frame to hold contents frame = Frame(nb, name='descrip') # widgets to be displayed on 'Description' tab # position and set resize behaviour frame.rowconfigure(1, weight=1) frame.columnconfigure((0, 1), weight=1, uniform=1) lf = LabelFrame(frame, text='Animals') lf.pack(pady=5, padx=5, side='left', fill='y') themes = ['horse', 'elephant', 'crocodile', 'bat', 'grouse'] self.ttkbut = [] for t in themes: b = Button(lf, text=t) b.pack(pady=2) self.ttkbut.append(b) lF2 = LabelFrame(frame, text="Theme Combobox") lF2.pack(pady=5, padx=5) themes = list(sorted( self.style.theme_names())) # get_themes # used in ttkthemes themes.insert(0, "Pick a theme") self.cb = cb = Combobox(lF2, values=themes, state="readonly", height=10) cb.set(themes[0]) #cb.bind('<<ComboboxSelected>>', self.change_style) cb.grid(row=0, column=0, sticky='nw', pady=5) lf1 = LabelFrame(frame, text='Checkbuttons') lf1.pack(pady=5, padx=5, side='left', fill='y') # control variables self.enabled = IntVar() self.cheese = IntVar() self.tomato = IntVar() self.basil = IntVar() self.oregano = IntVar() # checkbuttons self.cbOpt = Checkbutton(lf1, text='Enabled', variable=self.enabled, command=self._toggle_opt) cbCheese = Checkbutton(text='Cheese', variable=self.cheese, command=self._show_vars) cbTomato = Checkbutton(text='Tomato', variable=self.tomato, command=self._show_vars) sep1 = Separator(orient='h') cbBasil = Checkbutton(text='Basil', variable=self.basil, command=self._show_vars) cbOregano = Checkbutton(text='Oregano', variable=self.oregano, command=self._show_vars) sep2 = Separator(orient='h') self.cbs = [ self.cbOpt, sep1, cbCheese, cbTomato, sep2, cbBasil, cbOregano ] for opt in self.cbs: if opt.winfo_class() == 'TCheckbutton': opt.configure(onvalue=1, offvalue=0) opt.setvar(opt.cget('variable'), 0) opt.pack(in_=lf1, side='top', fill='x', pady=2, padx=5, anchor='nw') lf2 = LabelFrame(frame, text='Radiobuttons', labelanchor='n') lf2.pack(pady=5, padx=5, side='left', fill='y') self.rb = [] self.happiness = StringVar() for s in ['Great', 'Good', 'OK', 'Poor', 'Awful']: b = Radiobutton(lf2, text=s, value=s, variable=self.happiness, command=lambda s=s: self._show_vars()) b.pack(anchor='nw', side='top', fill='x', pady=5, padx=5) self.rb.append(b) right = LabelFrame(frame, text='Control Variables') right.pack(pady=5, padx=5, side='left', fill='y') self.vb0 = Label(right, font=('Courier', 10)) self.vb1 = Label(right, font=('Courier', 10)) self.vb2 = Label(right, font=('Courier', 10)) self.vb3 = Label(right, font=('Courier', 10)) self.vb4 = Label(right, font=('Courier', 10)) self.vb5 = Label(right, font=('Courier', 10)) self.vb0.pack(anchor='nw', pady=5, padx=5) self.vb1.pack(anchor='nw', pady=5, padx=5) self.vb2.pack(anchor='nw', pady=5, padx=5) self.vb3.pack(anchor='nw', pady=5, padx=5) self.vb4.pack(anchor='nw', pady=5, padx=5) self.vb5.pack(anchor='nw', pady=5, padx=5) self._show_vars() # add to notebook (underline = index for short-cut character) nb.add(frame, text='Description', underline=0, padding=2)
def initialize(self): self.IG = tk.Tk() self.IG.title('For ' + str(self.Model_name) + ' and ' + str(self.scenario_set)) self.IG.grid() self.FaultGeometry() self.FAULTSelect = StringVar() self.choixFAULT = list(set(self.Column_Fault_name)) self.listeFAULT = Combobox(self.IG, textvariable=self.FAULTSelect, values=self.choixFAULT, state='readonly') self.listeFAULT.grid(column=0, row=0, sticky='EW') self.listeFAULT.current(0) add_fault_button = Button(self.IG, text=u"Add fault to model", command=self.Add_fault_ButtonClick) add_fault_button.grid(column=1, row=0) add_all_faults_button = Button(self.IG, text=u"Add all faults to model", command=self.Add_all_faults_ButtonClick) add_all_faults_button.grid(column=4, row=0) suppr_fault_button = Button(self.IG, text=u"Delete fault from model", command=self.Delete_fault_ButtonClick) suppr_fault_button.grid(column=2, row=0) add_fault_to_scenario_button = Button( self.IG, text=u"Add fault to scenario", command=self.Add_fault_to_scenario_ButtonClick) add_fault_to_scenario_button.grid(column=2, row=1) suppr_fault_from_scenario_button = Button( self.IG, text=u"Delete fault from scenario", command=self.Delete_fault_from_scenario_ButtonClick) suppr_fault_from_scenario_button.grid(column=2, row=2) add_scenario_button = Button(self.IG, text=u"Add scenario to model", command=self.Add_scenario_ButtonClick) add_scenario_button.grid(column=6, row=1) suppr_scenario_button = Button( self.IG, text=u"Delete scenario from model", command=self.Delete_scenario_ButtonClick) suppr_scenario_button.grid(column=6, row=2) calcul_button = Button(self.IG, text=u"Create input file", command=self.CalculButtonClick) calcul_button.grid(column=14, row=10) self.ouverture_calcul = 0 self.listechoix_fault = Listbox(self.IG) self.listechoix_fault.grid(column=0, row=1, columnspan=2, rowspan=3, sticky='EW') self.listechoix_scenario_tmp = Listbox(self.IG) self.listechoix_scenario_tmp.grid(column=4, row=1, columnspan=2, rowspan=3, sticky='EW') self.listechoix_scenario = Listbox(self.IG, width=50) self.listechoix_scenario.grid(column=7, row=1, columnspan=4, rowspan=4, sticky='EW') self.IG.grid_columnconfigure(0, weight=1) self.IG.resizable(True, True) self.IG.mainloop()
def winloop(self): #win = Tk() #win.title("All CLASSIFICATIONS") #win.geometry('1800x1200') def donothing(): filewin = Toplevel(win) button = tk.Button(filewin, text="Do nothing button") button.pack() menubar = tkinter.Menu(self) filemenu = tkinter.Menu(menubar, tearoff=0) filemenu.add_command(label="New", command=donothing) filemenu.add_command(label="Open", command=donothing) filemenu.add_command(label="Save", command=donothing) filemenu.add_command(label="Save as...", command=donothing) filemenu.add_command(label="Close", command=donothing) filemenu.add_separator() filemenu.add_command(label="Exit", command=self.quit) menubar.add_cascade(label="File", menu=filemenu) editmenu = tk.Menu(menubar, tearoff=0) editmenu.add_command(label="Undo", command=donothing) editmenu.add_separator() editmenu.add_command(label="Cut", command=donothing) editmenu.add_command(label="Copy", command=donothing) editmenu.add_command(label="Paste", command=donothing) editmenu.add_command(label="Delete", command=donothing) editmenu.add_command(label="Select All", command=donothing) menubar.add_cascade(label="Edit", menu=editmenu) helpmenu = tk.Menu(menubar, tearoff=0) helpmenu.add_command(label="Help Index", command=donothing) helpmenu.add_command(label="About...", command=donothing) menubar.add_cascade(label="Help", menu=helpmenu) self.config(menu=menubar) frm1 = tk.Frame(self, bg='#34495E', width=1800, height=1200) frm1.pack() # Canvas canvas = tk.Canvas(frm1, width=1800, height=1200, bg='#5AFF00', bd=0, highlightthickness=0) canvas.place(x=0, y=0) canvas.create_image(1800, 1200, anchor=CENTER) # Task with Gui lbl = tk.Label(self, font=("Sain Serif", 26), bg='#2AB9E9', text="CREATING ALL CLASSIFICATION WITH GUI") lbl.place(x=350, y=115) # Selecting Your Data lbl1 = tk.Label(self, font=("Sain Serif", 18), bg='#2AB9E9', text="Select a CSV file") lbl1.place(x=350, y=170) o = clasif() clasif.in_file = tk.Button(self, text='SELECT', font=(5), width=(15), command=o.in_f) clasif.in_file.place(x=350, y=215) clasif.inf = tk.Entry(self, width=50) clasif.inf.place(x=515, y=220) clasif.infol = tk.Label(self, text='column titles : ', font=(10), width=(15), bg='#5AFF00') clasif.infol.place(x=350, y=265) clasif.info = tk.Entry(self, width=50) clasif.info.place(x=515, y=268) clasif.selx = tk.Label(self, text='select X : ', font=(10), width=(15), bg='#5AFF00') clasif.selx.place(x=350, y=300) clasif.sx = tk.Entry(self, width=20) clasif.sx.place(x=515, y=302) clasif.sely = tk.Label(self, text='select Y : ', font=(10), width=(15), bg='#5AFF00') clasif.sely.place(x=350, y=335) clasif.sy = tk.Entry(self, width=20) clasif.sy.place(x=515, y=335) clasif.l1 = tk.Label(self, text='Accuracy on training set ', bg='#5AFF00') clasif.l1.place(x=650, y=370) clasif.l2 = tk.Label(self, text='Accuracy on test set ', bg='#5AFF00') clasif.l2.place(x=850, y=370) clasif.loreg = tk.Button(self, text='Logistic Regression', font=(10), width=(25), command=o.log_reg) clasif.loreg.place(x=350, y=405) clasif.lr_tr = tk.Entry(self, width=20) clasif.lr_tr.place(x=650, y=405) clasif.lr_ts = tk.Entry(self, width=20) clasif.lr_ts.place(x=850, y=405) clasif.dtre = tk.Button(self, text='Decision Tree', font=(10), width=(25), command=o.d_tre) clasif.dtre.place(x=350, y=450) clasif.dtre_tr = tk.Entry(self, width=20) clasif.dtre_tr.place(x=650, y=450) clasif.dtre_ts = tk.Entry(self, width=20) clasif.dtre_ts.place(x=850, y=450) clasif.knn_bt = tk.Button(self, text='K-Nearest Neighbors', font=(10), width=(25), command=o.k_nn) clasif.knn_bt.place(x=350, y=495) clasif.knn_tr = tk.Entry(self, width=20) clasif.knn_tr.place(x=650, y=495) clasif.knn_ts = tk.Entry(self, width=20) clasif.knn_ts.place(x=850, y=495) clasif.lda = tk.Button(self, text='Linear Discriminant Analysis', font=(10), width=(25), command=o.l_da) clasif.lda.place(x=350, y=540) clasif.lda_tr = tk.Entry(self, width=20) clasif.lda_tr.place(x=650, y=540) clasif.lda_ts = tk.Entry(self, width=20) clasif.lda_ts.place(x=850, y=540) clasif.gnb = tk.Button(self, text='Gaussian Naive Bayes', font=(10), width=(25), command=o.g_nb) clasif.gnb.place(x=350, y=585) clasif.gnb_tr = tk.Entry(self, width=20) clasif.gnb_tr.place(x=650, y=585) clasif.gnb_ts = tk.Entry(self, width=20) clasif.gnb_ts.place(x=850, y=585) clasif.svm = tk.Button(self, text='Support Vector Machine', font=(10), width=(25), command=o.s_vm) clasif.svm.place(x=350, y=630) clasif.svm_tr = tk.Entry(self, width=20) clasif.svm_tr.place(x=650, y=630) clasif.svm_ts = tk.Entry(self, width=20) clasif.svm_ts.place(x=850, y=630) clasif.prd = tk.Button(self, text='Pred', font=(10), width=(10), command=o.prd) clasif.prd.place(x=1350, y=360) clasif.combo = Combobox(self, width=(30), font=(10)) clasif.combo['values'] = ("Logistic Regression", "Decision Tree", "K-Nearest Neighbors", "Linear Discriminant Analysis", "Gaussian Naive Bayes", "Support Vector Machine") clasif.combo.current(0) clasif.combo.place(x=1050, y=360) clasif.txt_mtx = tkinter.Text(self, height=8, width=60) clasif.txt_mtx.place(x=1050, y=405) clasif.txt_rpt = tkinter.Text(self, height=12, width=60) clasif.txt_rpt.place(x=1050, y=545)
label_jumptype=Label(text='落地页类型:',bg='#fff',height=2) label_adtype=Label(text='是否广告:',bg='#fff',height=2) label_blur=Label(text='背景是否变暗:',bg='#fff',height=2) label_showtime=Label(text='定时关闭:',bg='#fff',height=2) label_pageurl=Label(text='物料地址:',bg='#fff',height=2) label_jumpurl=Label(text='落地页地址:',bg='#fff',height=2) label_adid=Label(text='内容id:',bg='#fff',height=2) label_delaytime=Label(text='时间推移:',bg='#fff',height=2) label_title=Label(text='标题:',bg='#fff',height=2) label_adbstatu=Label(text='ADB:%s'%(adbstatu.get()),bg='#fff',height=2) lable_windowType=Label(text='窗口类型:',bg='#fff',height=2) width=Entry(root,width=10,bg="#c8f7fb", textvariable = var_width) height=Entry(root,width=10,bg="#c8f7fb", textvariable = var_height) gravity=Combobox(root, width=8,textvariable=var_gravity) marginx=Entry(root,width=10,bg="#c8f7fb", textvariable = var_marginx) marginy=Entry(root,width=10,bg="#c8f7fb", textvariable = var_marginy) msgtype=Combobox(root,width=7,textvariable=var_msgtype) jumptype=Combobox(root, width=7,textvariable=var_jumptype) adtype=Combobox(root,width=7,textvariable=var_adtype) blur=Combobox(root,width=7,textvariable=var_blur) showtime=Entry(root,width=10,bg="#aaf1f7", textvariable = var_showtime) delaytime=Entry(root,width=10,bg="#aaf1f7", textvariable = var_delaytime) pageurl=Entry(root,width=60,bg="#c8f7fb", textvariable = var_pageurl) jumpurl=Entry(root,width=60,bg="#c8f7fb", textvariable = var_jumpurl) adid=Entry(root,width=10,bg="#c8f7fb", textvariable = var_adid) title=Entry(root,width=60,bg="#c8f7fb", textvariable = var_title) ipinput=Entry(root,width=16,bg="#c8f7fb", textvariable = var_ipinput) windowType=Combobox(root,width=10, textvariable = var_window_type) normal_msg_input=Entry(root,width=26,bg="#c8f7fb", textvariable = var_normal_msg)
def __init__(self, master, *args, **kwargs): self.master = master self.img = PhotoImage(file='img.gif') self.la_img = Label(master, image=self.img) self.la_img.place(x=1170, y=100) self.la_title = Label(master, text='BarberShop', font=('arial', 25, 'bold')) self.la_title.place(x=5, y=5) self.pagmt_type = Combobox(master, width=25) self.pagmt_type.place(x=820, y=35) self.e_updesc = Entry(master, width=7, font=('arial 18 bold'), bd=1, relief="solid") self.e_updesc.place(x=700, y=30) self.la_updesc = Label(master, text='Desconto', font=('arial 8 bold'), fg='red') self.la_updesc.place(x=700, y=10) self.e_upqtd = Entry(master, width=7, font=('arial 18 bold'), bd=1, relief="solid") self.e_upqtd.place(x=550, y=30) self.la_upqtd = Label(master, text='Qtd Item', font=('arial 8 bold'), fg='red') self.la_upqtd.place(x=550, y=10) self.e_cb = Entry(master, width=35, font=('arial 15 bold'), bd=1, relief="solid") self.e_cb.place(x=30, y=80) self.e_nop = Entry(master, width=55, font=('arial 15 bold'), bd=1, relief="solid") self.e_nop.place(x=440, y=80) self.e_qtd = Entry(master, width=5, font=('arial 40 bold'), bd=1, relief="solid") self.e_qtd.place(x=30, y=150) self.la_qtd = Label(master, text='Quantidade', font=('arial 10 bold')) self.la_qtd.place(x=30, y=125) self.cb_func = Combobox(master, width=25) self.cb_func.place(x=220, y=150) self.la_func = Label(master, text='Funcionário', font=('arial 10 bold')) self.la_func.place(x=220, y=125) self.e_vup = Entry(master, width=6, font=('arial 40 bold'), bd=1, relief="solid") self.e_vup.place(x=470, y=150) self.la_vup = Label(master, text='Valor Unitário Produtos', font=('arial 10 bold')) self.la_vup.place(x=470, y=125) self.e_desc = Entry(master, width=6, font=('arial 40 bold'), bd=1, relief="solid") self.e_desc.place(x=670, y=150) self.la_vup = Label(master, text='Desconto', font=('arial 10 bold')) self.la_vup.place(x=670, y=125) self.e_prc = Entry(master, width=6, font=('arial 40 bold'), bd=1, relief="solid") self.e_prc.place(x=870, y=150) self.la_vup = Label(master, text='Valor Total Produtos', font=('arial 10 bold')) self.la_vup.place(x=870, y=125) self.tbox = Text(master, width=127, height=25, bd=2, relief="solid") self.tbox.place(x=30, y=220) self.new_vend = Button(master, text='Nova Venda', bg='#f17215', bd=2, relief='raise', width=15, height=2, command=self.novavenda) self.new_vend.place(x=30, y=650) self.vend = Button( master, text='Vendas', bg='#f17215', bd=2, relief='raise', width=15, height=2, ) self.vend.place(x=170, y=650) self.init = Button( master, text='Iniciar Caixa', bg='#f17215', bd=2, relief='raise', width=15, height=2, ) self.init.place(x=310, y=650) self.cad_prod = Button( master, text='Cadastro/Produtos', bg='#f17215', bd=2, relief='raise', width=15, height=2, ) self.cad_prod.place(x=450, y=650) self.cad_client = Button( master, text='Cadastro/Clientes', bg='#f17215', bd=2, relief='raise', width=15, height=2, ) self.cad_client.place(x=590, y=650) self.final_vend = Button( master, text='Finalizar Venda', bg='#f17215', bd=2, relief='raise', width=15, height=2, ) self.final_vend.place(x=730, y=650) self.print = Button( master, text='Imprimir Relatório', bg='#f17215', bd=2, relief='raise', width=15, height=2, ) self.print.place(x=870, y=650) self.la_total = Label(master, width=160, height=6, bg='#aff9d7') self.la_total.place(x=50, y=720)
def create_window(self): # 输入区域窗口 type_content_box = ScrolledText( self.master, width=54, height=10, font=('微软雅黑', 12), ) type_content_box.insert( END, '在此处输入文字、网址 即可翻译', ) type_content_box.focus_set() type_content_box.pack(side=LEFT, expand=True) # 显示区域窗口 trans_result_box = ScrolledText( self.master, width=54, height=11, bg='#D3D3D3', font=('consolas', 11), ) trans_result_box.focus_set() trans_result_box.pack(side=RIGHT, expand=True) # 自动检测语言 auto_language = Button( self.master, text=' 自动检测语言 ', state='disabled', relief='flat', bg='#ffffff', fg='#000000', font=('微软雅黑', 11), ) auto_language.place(x=5, y=90) # 选择语言 language = StringVar() language_chosen = Combobox( self.master, width=12, textvariable=language, ) language_chosen['values'] = ['中文', '英语', '日语'] # 设置下拉列表的值 language_chosen.place(x=25 * 7, y=100) language_chosen.current(0) # 运行结果按钮 run_after = Button( self.master, state=DISABLED, width=10, relief='flat', font=('微软雅黑', 11), ) run_after.place(x=72 * 7 + 4, y=90) # 显示翻译结果 def show_trans_result(): global translate_result trans_result_box.delete('1.0', END) # 运行结果按钮状态:正在翻译 run_after.config( text='正在翻译', bg='#ffffff', fg='#000000', ) if type_content_box.count('1.0', END) > tuple([0]): translate_result = translate.baidu_translate( text=type_content_box.get('1.0', 'end-1c'), to=language.get()) # 在翻译结果区域显示结果 trans_result_box.insert(END, translate_result) # 运行结果按钮状态:运行结果 run_after.config(text='运行结果') # 翻译按钮 translate_button = Button( self.master, text='翻 译', width=10, bg='#6495ED', fg='#ffffff', relief='flat', command=lambda: show_trans_result(), font=('微软雅黑', 11), ) translate_button.place(x=55 * 7 + 5, y=90) # 底部版权信息 copyright = Label( self.master, text=__copyright_info__, font=('consolas', 11), ) copyright.place(x=(960 - len(__copyright_info__) * 7.5) / 2, y=480 - 22)
def font_dialogue(self): '''Font selection: dialogue for font choices''' dprint(3, "\nTkMemobook::font_dialogue:: ") def set_string_variable(var, val): var.set(val) def set_font(getter, fam, sz, wt): self.ctrl["font"]["family"] = fam self.ctrl["font"]["size"] = sz self.ctrl["font"]["weight"] = wt self.tabs.set_page_font(fam, sz, wt) getter.destroy() getter = Toplevel(self.root) getter.title("Font selection") family_str = StringVar(getter) family_str.set(self.ctrl["font"]["family"]) size_str = StringVar(getter) size_str.set(self.ctrl["font"]["size"]) weight_str = StringVar(getter) weight_str.set(self.ctrl["font"]["weight"]) possible_fams = list(font.families(root=self.root)) possible_fams.sort(key=lambda x: x[0]) display_frame = Frame(getter) instr_frame = Frame(display_frame) instr_instr = Label(instr_frame, text="Please select a font:") instr_examp = Label(instr_frame, text=family_str.get(), font=(family_str.get(),12,"normal")) family_str.trace_add("write", lambda x,y,z: instr_examp.config(text=family_str.get(), font=(family_str.get(), 12, weight_str.get()))) weight_str.trace_add("write", lambda x,y,z: instr_examp.config(text=family_str.get(), font=(family_str.get(), 12, weight_str.get()))) label_frame = Frame(display_frame) label_family = Label(label_frame,text="Family:") label_size = Label(label_frame,text="Size:") label_weight = Label(label_frame,text="Weight:") choice_frame = Frame(display_frame) choice_family = Combobox(choice_frame, textvariable=family_str, values=possible_fams) choice_size = Combobox(choice_frame, textvariable=size_str, values=(6,8,10,12,14,16,18,20,24,28,32,48,64,72), postcommand=lambda: set_string_variable(size_str, self.ctrl["font"]["size"])) choice_weight = Combobox(choice_frame, textvariable=weight_str, values=("normal","bold","italic")) finish_frame = Frame(getter) finish_cancel = Button(finish_frame, text="Cancel", command=lambda: getter.destroy()) finish_apply = Button(finish_frame, text="Apply", command=lambda: set_font(getter, family_str.get(), size_str.get(), weight_str.get())) instr_instr.pack(side="top", anchor="w") instr_examp.pack(side="bottom", anchor="w") instr_frame.pack() label_family.pack(anchor="w") label_size.pack(anchor="w") label_weight.pack(anchor="w") label_frame.pack(side="left") choice_family.pack(anchor="w", fill="x", expand="true") choice_size.pack(anchor="w", fill="x", expand="true") choice_weight.pack(anchor="w", fill="x", expand="true") choice_frame.pack(side="left", expand="true", fill="x") display_frame.pack(side="top", expand="true", fill="both") finish_cancel.pack(side="left") finish_apply.pack(side="right") finish_frame.pack(side="bottom")
def _create_windowview(self, parent, playlistTable): label = tk.Label(self.editPlaylistNameWindow, text="リスト名 :") label.grid(row=0, column=0, sticky="w", padx=10, pady=(10, 10)) self.entry_list_name = Entry(self.editPlaylistNameWindow) self.entry_list_name.grid(row=0, column=1, columnspan=3, sticky="we") label = tk.Label(self.editPlaylistNameWindow, text="定型文 :") label.grid(row=1, column=0, sticky="w", padx=10) self.cb_regular_gate = Combobox(self.editPlaylistNameWindow, state="readonly") self.refresh_cb_regular_gate() self.cb_regular_gate.current(0) self.cb_regular_gate.grid(row=1, column=1, columnspan=3, sticky="wens") self.set_entry_list_name(playlistTable) settingBtnFrame = tk.Frame(self.editPlaylistNameWindow) settingBtnFrame.grid(row=0, column=4, rowspan=3, sticky='ens') btn_setting_playlist = Button( settingBtnFrame, text="設定", command=lambda: self.update_playlist_name(playlistTable)) btn_setting_playlist.grid(sticky='wens', row=0, column=0, padx=5, pady=(10, 10), ipadx=5, ipady=3) btn_cancel = Button(settingBtnFrame, text="キャンセル", command=self.close_window) btn_cancel.grid(sticky='wens', row=1, column=0, padx=5, ipadx=5, ipady=3) regularGateFrame = tk.Frame(self.editPlaylistNameWindow) regularGateFrame.grid(row=2, column=0, sticky='wens') ck_apply_only_regular_gate = Checkbutton( regularGateFrame, variable=self.ckValue_apply_only_reguar_gate, text="定型文のみ変更", onvalue=True, offvalue=False) ck_apply_only_regular_gate.deselect() ck_apply_only_regular_gate.grid(row=0, column=0, padx=(6, 0), pady=(10, 0), sticky="") btn_update_regular_gates = Button( regularGateFrame, text="定型文編集", command=lambda: self.regular_gate_list(parent, playlistTable)) btn_update_regular_gates.grid(row=1, column=0, padx=(10, 0), pady=(5, 0), ipady=3, sticky='we') updateModeFrame = tk.LabelFrame(self.editPlaylistNameWindow, text='変更モード') updateModeFrame.grid(row=2, column=2, columnspan=2, rowspan=2, sticky='wens', padx=(10, 0), pady=10) rb_selection_update = tk.Radiobutton( updateModeFrame, text="選択行のみ", value=1, variable=self.rbPlayListNameUpdateModeValue) rb_samename_update = tk.Radiobutton( updateModeFrame, text="同ー名のみ", value=2, variable=self.rbPlayListNameUpdateModeValue) rb_all_update = tk.Radiobutton( updateModeFrame, text="全て", value=3, variable=self.rbPlayListNameUpdateModeValue) rb_selection_update.grid(row=0, column=0, sticky='w', padx=10, pady=(10, 0)) rb_samename_update.grid(row=1, column=0, sticky='w', padx=10, pady=(5, 0)) rb_all_update.grid(row=2, column=0, sticky='w', padx=10, pady=(5, 0))
def __init__(self, parent, controller): tk.Frame.__init__(self, parent) label = tk.Label(self, text="The name of the patient :", font=('calibri', 14)) label.place(x=self.winfo_screenmmheight() / 2 + 50, y=50) e = tk.Entry(self) e.place(x=self.winfo_screenmmheight() / 2 + 250, y=55, height=25, width=150) label = tk.Label(self, text="The name of the test :", font=('calibri', 14)) label.place(x=self.winfo_screenmmheight() / 2 + 50, y=80) e = tk.Entry(self) e.place(x=self.winfo_screenmmheight() / 2 + 250, y=85, height=25, width=150) label = tk.Label(self, text="The date of the test :", font=('calibri', 14)) label.place(x=self.winfo_screenmmheight() / 2 + 50, y=110) var = StringVar() var.set("1") data = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31') cb = Combobox(self, values=data) cb.place(x=self.winfo_screenmmheight() / 2 + 250, y=115, height=25, width=40) var.set("January") data = (' January', ' February', ' March', ' April', ' May', ' June', ' July', ' August', ' September', ' October', ' November', ' December') cb = Combobox(self, values=data) cb.place(x=self.winfo_screenmmheight() / 2 + 292, y=115, height=25, width=90) var.set("2020") data = (' 2020', ' 2021', ' 2022') cb = Combobox(self, values=data) cb.place(x=self.winfo_screenmmheight() / 2 + 384, y=115, height=25, width=60) #e = tk.Entry(self) #e.place(x=self.winfo_screenmmheight()/2+250,y=115,height=25,width=150) label = tk.Label(self, text="The type of the test :", font=('calibri', 14)) label.place(x=self.winfo_screenmmheight() / 2 + 50, y=140) #var=StringVar() var.set("one") data = ("one", "two", "three", "four") cb = Combobox(self, values=data) cb.place(x=self.winfo_screenmmheight() / 2 + 250, y=145, height=25, width=150) #e = tk.Entry(self) #e.place(x=self.winfo_screenmmheight()/2+250,y=145,height=25,width=150) #button = ttk.Button(self, text="Visit Page 1", # command=lambda: controller.show_frame(PageOne)) #button.pack() #button2 = ttk.Button(self, text="Visit Page 2", # command=lambda: controller.show_frame(PageTwo)) #button2.pack() # style = ttk.Style() style = ThemedStyle(self) style.set_theme("plastik") style.configure('TButton', font=('calibri', 20, 'bold'), borderwidth='10', foreground='blue', width=20) button = ttk.Button(self, text="Start Monitoring", command=lambda: controller.show_frame(PageThree)) button.place(x=self.winfo_screenmmheight() + 20, y=self.winfo_screenmmwidth() - 40)
copy_button = Button(root, text="Copy", command=copypasswd) copy_button.grid(row=0, column=2) #create label for password length c_label = Label(root, text="Length") c_label.grid(row=1) #create generate button generate_button = Button(root, text="Generate", command=generate) generate_button.grid(row=1, column=2) #strength selector radio_low = Radiobutton(root, text="Low", variable=var, value=1) radio_low.grid(row=2, column=0, sticky='N') radio_middle = Radiobutton(root, text="Medium", variable=var, value=0) radio_middle.grid(row=2, column=1, sticky='N') radio_strong = Radiobutton(root, text="Strong", variable=var, value=3) radio_strong.grid(row=2, column=2, sticky='N') combo = Combobox(root, textvariable=var1) #Combo Box for password length combo['values'] = (8, 10, 12, 14, 16, 18, 20, 22, 24) combo.current(0) combo.bind('<<ComboboxSelected>>') combo.grid(column=1, row=1) #start GUI root.mainloop()
def create_widgets(self): '''Create the tkinter UI''' example_supported = ( self.ai_props.num_ai_chans > 0 and self.ai_props.supports_analog_trig) if example_supported: main_frame = tk.Frame(self) main_frame.pack(fill=tk.X, anchor=tk.NW) float_vcmd = self.register(self.validate_float_entry) curr_row = 0 if self.ai_props.num_ai_chans > 1: channel_vcmd = self.register(self.validate_channel_entry) low_channel_entry_label = tk.Label(main_frame) low_channel_entry_label["text"] = "Low Channel Number:" low_channel_entry_label.grid( row=curr_row, column=0, sticky=tk.W) self.low_channel_entry = tk.Spinbox( main_frame, from_=0, to=max(self.ai_props.num_ai_chans - 1, 0), validate='key', validatecommand=(channel_vcmd, '%P')) self.low_channel_entry.grid( row=curr_row, column=1, sticky=tk.W) curr_row += 1 high_channel_entry_label = tk.Label(main_frame) high_channel_entry_label["text"] = "High Channel Number:" high_channel_entry_label.grid( row=curr_row, column=0, sticky=tk.W) self.high_channel_entry = tk.Spinbox( main_frame, from_=0, validate='key', to=max(self.ai_props.num_ai_chans - 1, 0), validatecommand=(channel_vcmd, '%P')) self.high_channel_entry.grid( row=curr_row, column=1, sticky=tk.W) initial_value = min(self.ai_props.num_ai_chans - 1, 3) self.high_channel_entry.delete(0, tk.END) self.high_channel_entry.insert(0, str(initial_value)) curr_row += 1 trigger_type_label = tk.Label(main_frame) trigger_type_label["text"] = "Trigger Type:" trigger_type_label.grid(row=curr_row, column=0, sticky=tk.W) self.trigger_type_combobox = Combobox(main_frame) self.trigger_type_combobox["values"] = ["Above", "Below"] self.trigger_type_combobox["state"] = "readonly" self.trigger_type_combobox.current(0) self.trigger_type_combobox.grid( row=curr_row, column=1, sticky=tk.W) curr_row += 1 trigger_level_label = tk.Label(main_frame) trigger_level_label["text"] = "Trigger Level:" trigger_level_label.grid(row=curr_row, column=0, sticky=tk.W) self.trigger_level_entry = tk.Entry( main_frame, validate='key', validatecommand=(float_vcmd, '%P')) self.trigger_level_entry.grid( row=curr_row, column=1, sticky=tk.W) self.trigger_level_entry.insert(0, "2") self.results_group = tk.LabelFrame( self, text="Results", padx=3, pady=3) self.results_group.pack(fill=tk.X, anchor=tk.NW, padx=3, pady=3) self.data_frame = tk.Frame(self.results_group) self.data_frame.grid() curr_row += 1 warning_label = tk.Label( main_frame, justify=tk.LEFT, wraplength=400, fg="red") warning_label["text"] = ( "Warning: Clicking Start will freeze the UI until the " "trigger condition is met and the scan completes. " "Real-world applications should run the a_pretrig method " "on a separate thread or use the BACKGROUND option.") warning_label.grid(row=curr_row, columnspan=2, sticky=tk.W) button_frame = tk.Frame(self) button_frame.pack(fill=tk.X, side=tk.RIGHT, anchor=tk.SE) self.start_button = tk.Button(button_frame) self.start_button["text"] = "Start" self.start_button["command"] = self.start self.start_button.grid(row=0, column=0, padx=3, pady=3) quit_button = tk.Button(button_frame) quit_button["text"] = "Quit" quit_button["command"] = self.master.destroy quit_button.grid(row=0, column=1, padx=3, pady=3) else: self.create_unsupported_widgets(self.board_num)
window = Tk() window.title("Get Ready to board a plane!") # background_image= PhotoImage('cheapo-mega.png') # background_label = Label(window, image=background_image) # background_label.place(x=0, y=0, relwidth=1, relheight=1) # window.configure(background=background_image) window.configure(background="gray") window.geometry('1000x500') lblscheme = Label(window, text="Choose a Boarding Scheme") lblscheme.grid(column=0, row=0) combo = Combobox(window) combo['values']= ('BTF', 'BLOCK','WILMA', 'RASS', 'RFOALL', 'STFOPT','STFMOD','Amigos','REVPYR') combo.current(0) #set the selected item combo.grid(column=1, row=0) lblrow = Label(window, text="Number of Rows") lblrow.grid(column=0, row=1) txtrow = Entry(window,width=4) txtrow.insert(END,30) txtrow.grid(column=1, row=1) lblcol = Label(window, text="Number of Columns") lblcol.grid(column=0, row=2) txtcol = Entry(window,width=4) txtcol.insert(END,6) txtcol.grid(column=1, row=2) lblgroup = Label(window, text="Number of Groups") lblgroup.grid(column=0, row=3)
window_show)) btn.grid(column=2, row=3) window_show.mainloop() #def OptionCallBack(*args): #print variable.get() window.geometry('500x350') variable = StringVar(window) #variable = str() variable.set("Select From List") #variable.trace('w', OptionCallBack) combo = Combobox(window, textvariable=variable) all_v = ("Sample", "Variant", "Population", "Phenotype", "Phenotype_Variant", "Population_variant", "Sample_variant") combo['values'] = all_v #combo.current(1) # установите вариант по умолчанию combo.grid(column=0, row=0) name_table = combo.current() print(name_table) btn = Button(window, text="Посмотреть", command=partial(clicked, variable)) btn.grid(column=1, row=0) btn = Button(window, text="Добавить", command=partial(clicked1, variable)) btn.grid(column=2, row=0) def del_sample(id_sampe):
def createWidget(self, master): """组件初始化""" # 关于画图,完全可以使用matplotlib来实现 self.drawbox = Canvas(root, width=598, height=498, bg=self.canvasbg, bd=1, relief="solid") self.drawbox.place(x=10, y=20) # 右键菜单栏 self.drawbox.bind("<Button-3>", self.createContextMenu) # 功能区 self.funcbox = Frame(width=270, height=500) self.funcbox.place(x=620, y=22) # 操作栏 self.operatebox = Frame(self.funcbox, width=269, height=25) self.operatebox.place(x=0, y=0) # 详情栏 self.detailbox = LabelFrame(self.funcbox, width=269, height=470) self.detailbox.place(x=0, y=30) # 操作标签 self.bt_line = Label(self.operatebox, text="直线", name="line", bd=1, relief="raised") self.bt_line.place(x=0, relwidth=0.2, relheight=1) self.bt_graph = Label(self.operatebox, text="图形", name="graph", bd=1, relief="raised") self.bt_graph.place(relx=0.2 * 1, relwidth=0.2, relheight=1) self.bt_pen = Label(self.operatebox, text="画笔", name="pen", bd=1, relief="raised") self.bt_pen.place(relx=0.2 * 2, relwidth=0.2, relheight=1) self.bt_erasor = Label(self.operatebox, text="橡皮", name="erasor", bd=1, relief="raised") self.bt_erasor.place(relx=0.2 * 3, relwidth=0.2, relheight=1) self.bt_option = Label(self.operatebox, text="设置", name="option", bd=1, relief="raised") self.bt_option.place(relx=0.2 * 4, relwidth=0.2, relheight=1) # 直线详情框 self.linebox = Frame(self.detailbox, width=269, height=470) # 箭头类型 Label(self.linebox, text="ArrowStyle").place(x=30, y=40) self.set_arrow = Combobox(self.linebox, state="readonly", values=["\\", "<--", "-->", "<->"]) self.set_arrow.current(0) self.set_arrow.place(x=110, y=40, relwidth=0.4) # 线型 Label(self.linebox, text="LineStyle").place(x=30, y=80) self.set_style = Combobox(self.linebox, state="readonly", values=["-", "--"]) self.set_style.current(0) self.set_style.place(x=110, y=80, relwidth=0.4) # 模式 Label(self.linebox, text="PenMode").place(x=30, y=120) self.set_mode = Combobox(self.linebox, state="readonly", values=["Single", "Multiple", "Radial"]) self.set_mode.current(0) self.set_mode.place(x=110, y=120, relwidth=0.4) # 线宽 Label(self.linebox, text="LineWidth").place(x=30, y=160) check = self.register(self.numberonly) self.set_ld = Entry(self.linebox, highlightcolor="sky blue", highlightthickness=1, textvariable=self.ld, validate="key", validatecommand=(check, '%P')) self.set_ld.place(x=110, y=160, relwidth=0.4) self.ld.set(1) self.ld.trace("w", self.lsketchshow) # 预览图 self.linesketchbox = Frame(self.linebox, height=140, bd=1, relief='groove') self.linesketchbox.place(y=330, relwidth=1) self.linesketch = Canvas(self.linesketchbox, width=98, height=98, bg=self.canvasbg, bd=1, relief="solid") Label(self.linesketchbox, text="效果图").place(x=30, y=60) self.linesketch.place(x=110, y=20) self.linesketch.create_line(0, 50, 100, 50, width=1) # 图形详情栏 self.graphbox = Frame(self.detailbox, width=269, height=470) # 图形类型 Label(self.graphbox, text="GraphStyle").place(x=30, y=40) self.set_gtype = Combobox( self.graphbox, values=["Rectangle", "Oval"], state="readonly", ) self.set_gtype.current(0) self.set_gtype.place(x=110, y=40, relwidth=0.4) # 填充类型 Label(self.graphbox, text="FillStyle").place(x=30, y=80) self.set_fillstyle = Combobox(self.graphbox, state="readonly", values=["outline", "fill"]) self.set_fillstyle.current(0) self.set_fillstyle.place(x=110, y=80, relwidth=0.4) # 颜色 Label(self.graphbox, text="Color").place(x=30, y=120) self.set_gcolor = Combobox(self.graphbox, state="readonly", values=["red", "blue"]) self.set_gcolor.current(0) self.set_gcolor.place(x=110, y=120, relwidth=0.4) # 线宽 Label(self.graphbox, text="LineWidth").place(x=30, y=160) self.set_gld = Entry(self.graphbox, highlightcolor="sky blue", highlightthickness=1, textvariable=self.gld, validate="key", validatecommand=(check, '%P')) self.set_gld.place(x=110, y=160, relwidth=0.4) self.gld.set(1) self.gld.trace("w", self.gsketchshow) # 预览图 self.graphsketchbox = Frame(self.graphbox, height=140, bd=1, relief='groove') self.graphsketchbox.place(y=330, relwidth=1) self.graphsketch = Canvas(self.graphsketchbox, width=98, height=98, bg=self.canvasbg, bd=1, relief="solid") Label(self.graphsketchbox, text="效果图").place(x=30, y=60) self.graphsketch.place(x=110, y=20) self.graphsketch.create_rectangle(12.5, 87.5, 87.5, 12.5, outline="red", width=1) # 画笔区 self.penbox = Frame(self.detailbox, width=269, height=470) Label(self.penbox, text="PenWidth").place(x=30, y=40) self.set_pld = Entry(self.penbox, highlightcolor="sky blue", highlightthickness=1, textvariable=self.pld, validate="key", validatecommand=(check, '%P')) self.set_pld.place(x=110, y=40, relwidth=0.4) self.pld.set(1) # 橡皮详情区 self.erasorbox = Frame(self.detailbox, width=269, height=470) # 橡皮类型 Label(self.erasorbox, text="Erasortype").place(x=30, y=40) self.set_etype = Combobox( self.erasorbox, values=["Rectangle", "Oval"], state="readonly", ) self.set_etype.current(0) self.set_etype.place(x=110, y=40, relwidth=0.4) # 橡皮大小 Label(self.erasorbox, text="ErasorSize").place(x=30, y=80) self.esize.set(4) self.set_eld = Entry(self.erasorbox, highlightcolor="sky blue", highlightthickness=1, textvariable=self.esize, validate="key", validatecommand=(check, '%P')) self.set_eld.place(x=110, y=80, relwidth=0.4) self.esize.trace("w", self.esketchshow) # 预览图 self.esketchbox = Frame(self.erasorbox, height=140, bd=1, relief='groove') self.esketchbox.place(y=330, relwidth=1) self.esketch = Canvas(self.esketchbox, width=98, height=98, bg=self.canvasbg, bd=1, relief="solid") Label(self.esketchbox, text="效果图\n(颜色仅供参考)").place(x=30, y=60) self.esketch.place(x=120, y=20) self.esketch.create_rectangle(46, 46, 54, 54, outline="violet", width=1) # 设置区 self.optionbox = Frame(self.detailbox, width=269, height=470) Label(self.optionbox, text="ColorMode").place(x=30, y=40) self.drawcolor.set("#ff0000") self.set_colormode = Combobox(self.optionbox, state="readonly", values=["Ox", "Chooser"]) self.set_colormode.current(0) self.set_colormode.place(x=120, y=40, relwidth=0.4) self.oxbox = Frame(self.optionbox, width=269, height=470) self.oxbox.place(x=0, y=75) Label(self.oxbox, text="Colorname").place(x=30, y=0) self.oxcolor = Entry(self.oxbox, highlightcolor="sky blue", textvariable=self.oxflash, highlightthickness=1, width=15) self.oxflash.set('#ff0000') self.oxcolor.place(x=120, y=0) self.oxshow = Label(self.oxbox, bg='red', bd=1, relief='solid') self.oxshow.place(x=240, y=0, width=20, height=20) self.oxtip = Label(self.oxbox) self.oxtip.place(x=30, y=25, relwidth=0.95) self.oxflash.trace('w', self.oxsetcolor) self.chbox = Frame(self.optionbox, width=269, height=470) Label(self.chbox, text="Colorset").place(x=30, y=0) self.colorboard = Label(self.chbox) self.colorboard['text'] = '#ff0000' self.colorboard.place(x=120, y=0) Button(self.chbox, text="⚙", command=self.setcolor).place(x=210, y=0) # 按钮效果通过边框样式的改变实现->sunken self.bt_line.bind("<Button-1>", self.eventmanager) self.bt_graph.bind("<Button-1>", self.eventmanager) self.bt_pen.bind("<Button-1>", self.eventmanager) self.bt_erasor.bind("<Button-1>", self.eventmanager) self.bt_option.bind("<Button-1>", self.eventmanager) self.set_arrow.bind("<<ComboboxSelected>>", self.lsketchshow) self.set_style.bind("<<ComboboxSelected>>", self.lsketchshow) self.set_mode.bind("<<ComboboxSelected>>", self.lsketchshow) self.set_gtype.bind("<<ComboboxSelected>>", self.gsketchshow) self.set_gcolor.bind("<<ComboboxSelected>>", self.gsketchshow) self.set_fillstyle.bind("<<ComboboxSelected>>", self.gsketchshow) self.set_etype.bind("<<ComboboxSelected>>", self.esketchshow) self.set_colormode.bind("<<ComboboxSelected>>", self.colormode) # 快捷键设定,此处监听了所有按键 master.bind("<KeyPress>", self.shortcut) # Top Menubar menubar = Menu(master) filemenu = Menu(menubar, tearoff=0) # tearoff是否可以拖撰单独显示 helpmenu = Menu(menubar, tearoff=0) # tearoff是否可以拖撰单独显示 operationmenu = Menu(menubar, tearoff=0) # tearoff是否可以拖撰单独显示 menubar.add_cascade(label="File", menu=filemenu) menubar.add_cascade(label="Operation", menu=operationmenu) menubar.add_cascade(label="Help", menu=helpmenu) # 分割线 filemenu.add_command(label="Load", accelerator="Ctrl+O", command=self.loadfig) filemenu.add_command(label="Save", accelerator="Ctrl+S", command=self.savefig) filemenu.add_separator() filemenu.add_command(label="Exit", command=master.quit) modemenu = Menu(master, tearoff=0) operationmenu.add_command(label='Clear', accelerator="Ctrl+C", command=self.clearfig) helpmenu.add_command(label="About us") master.config(menu=menubar) # self.rightmenu self.rightmenu = Menu(master, tearoff=0) self.rightmenu.add_command(label='Clear', accelerator="Ctrl+C", command=self.clearfig) self.rightmenu.add_command(label="Load", command=self.loadfig) self.rightmenu.add_command(label="Save", command=self.savefig) self.rightmenu.add_separator() self.rightmenu.add_command(label="Exit", command=master.quit) self.rightmenu.add_command(label="About us")
def __init__(self): Tk.__init__(self) frame = Frame(self) frame.pack() #Arduino CONECTION try: self.con = serial.Serial('/dev/ttyACM0', 230400) print(self.con) except IOError: self.con = serial.Serial('/dev/ttyACM1', 230400) print(self.con) #DMX CONECTION #try: # self.dmx = serial.Serial('/dev/ttyUSB0', 57600) # print(self.dmx) #except IOError: # self.dmx = serial.Serial('/dev/ttyUSB11', 57600) # print(self.dmx) # VARS self.do_send = False self.do_send_rgb = False self.sendSpeed = 20 self.cubeWorld = CubeWorld() self.world = np.zeros([3, 10, 10, 10]) self.send_header = [] self.framecount = 1 self.send_array_rgb = [] # self.send_list =[] self.artnet_switch = IntVar() # callback variable for artnet switch self.artnet_color_switch = IntVar( ) # callback variable for artnet switch # load generators and effects self.generators = [ "g_blank", "g_random", "g_orbiter", "g_randomlines", "g_sphere", "g_planes", "g_planes_falling", "g_shooting_star", "g_orbiter2", "g_randomcross", "g_growing_corner", "g_rain", "g_falling", "g_obliqueplane", "g_obliqueplaneXYZ", "g_torusrotation", "g_growingface", "g_orbiter3", "g_gauss", "g_wave", 'a_orbbot', 'g_squares', 'g_rotate_plane', 'g_soundcube', 'g_bouncy', 'g_sound_sphere', 'g_trees', 'g_soundrandom', 'g_orbiter_big', 'g_centralglow', 'g_sound_grow', 'g_edgeglow', 'g_blackhole', 'g_rotating_cube', 'g_sides', 'g_growing_square', 'g_swell', 'g_supernova', 'a_pulsating', 'a_pulsating_torus', 'a_jukebox', 'a_jukebox_ambient' 'a_random_cubes', 'a_lines', 'a_multi_cube_edges', 'a_squares_cut', 'g_soundsnake', "g_circles", 'g_collision', "g_corner", "g_corner_grow", "g_cube", 'g_cube_edges', 'g_cut', "g_drop", 'g_darksphere', "g_growing_sphere", 'g_inandout', 'g_osci_corner', "g_pyramid_upsidedown", "g_pyramid" 'g_rising_square', "g_smiley", "g_snake", "g_column", "a_multi_cube_edges_2", 'g_text' ] # 'g_2d_randomlines', 'g_2d_growing_circle', 'g_2d_rain', 'g_2d_square', 'g_2d_test', 'g_2d_portal', 'g_2d_random', 'g_2d_random_squares', 'g_2d_orbiter', 'g_2d_conway', 'g_2d_column', 'g_2d_growing_circle_2','g_2d_moving_orbiter', 'g_2d_outer_square'] # 'g_2d_patches', self.effects = [ "e_blank", "e_fade2blue", "e_rainbow", "e_staticcolor", "e_violetblue", "e_redyellow", "e_tremolo", "e_gradient", "e_prod_saturation", "e_prod_hue", "e_bright_osci", 'e_cut_cube', 'e_rare_strobo', 'e_s2l', 'e_remove_random', 'e_rotating_blue_orange', 'e_rotating_black_white', 'e_rotating_black_blue', 'e_squared', 'e_rotating_black_orange', 'e_rotating_black_red', 'e_s2l_shiftcolor', 'e_s2l_revis', 'e_random_brightness', 'e_mean', 'e_mean_vertical', 'e_growing_sphere' ] # sort generators and effects self.generators.sort() self.effects.sort() #array for transmission self.send_array_rgb = bytearray(3004) # what am i for? self.MidiButtonListBool = { 1: False, 4: False, 7: False, 10: False, 13: False, 16: False, 19: False, 22: False, 3: False, 6: False, 9: False, 12: False, 15: False, 18: False, 21: False, 24: False } #self.funkyImage = Text(frame) #img = BitmapImage( file='l3dBanner.bmp') ###self.funkyImage.image_create(END, image = img) #self.funkyImage.grid(row=10, column=3) self.font = 'Arial' ''' self.pic0 = PhotoImage(file='banner/l3dbanner-0.png') self.imgLabel0 = Label(frame,image=self.pic0) self.imgLabel0.grid(row=10,column=0) self.pic1 = PhotoImage(file='banner/l3dbanner-1.png') self.imgLabel1 = Label(frame,image=self.pic1) self.imgLabel1.grid(row=10,column=1) self.pic2 = PhotoImage(file='banner/l3dbanner-2.png') self.imgLabel2 = Label(frame,image=self.pic2) self.imgLabel2.grid(row=10,column=2) self.pic3 = PhotoImage(file='banner/l3dbanner-3.png') self.imgLabel3 = Label(frame,image=self.pic3) self.imgLabel3.grid(row=10,column=3) self.pic4 = PhotoImage(file='banner/l3dbanner-4.png') self.imgLabel4 = Label(frame,image=self.pic4) self.imgLabel4.grid(row=10,column=4) self.pic5 = PhotoImage(file='banner/l3dbanner-5.png') self.imgLabel5 = Label(frame,image=self.pic5) self.imgLabel5.grid(row=10,column=5) ''' # ## GUI Callabcks def optionmenuG1_selection(event): self.cubeWorld.set_Genenerator("A", self.dropdownG1.get(), 0) pass def optionmenuG2_selection(event): self.cubeWorld.set_Genenerator("B", self.dropdownG2.get(), 0) pass def optionmenuG3_selection(event): self.cubeWorld.set_Genenerator("C", self.dropdownG3.get(), 0) pass def optionmenuE11_selection(event): self.cubeWorld.set_Genenerator("A", self.dropdownE11Current.get(), 1) pass def optionmenuE12_selection(event): self.cubeWorld.set_Genenerator("B", self.dropdownE12Current.get(), 1) pass def optionmenuE13_selection(event): self.cubeWorld.set_Genenerator("C", self.dropdownE13Current.get(), 1) pass def optionmenuE21_selection(event): self.cubeWorld.set_Genenerator("A", self.dropdownE21Current.get(), 2) pass def optionmenuE22_selection(event): self.cubeWorld.set_Genenerator("B", self.dropdownE22Current.get(), 2) pass def optionmenuE23_selection(event): self.cubeWorld.set_Genenerator("C", self.dropdownE23Current.get(), 2) pass # GUI Elements self.startButton = Button(frame, text="Start", command=self.startsending) self.startButton.grid(row=0, column=4) self.stopButton = Button(frame, text="Stop", command=self.stopsending) self.stopButton.grid(row=0, column=5) self.BrightnesValue = StringVar() self.ShutterValue = StringVar() self.Brightnes = Label(frame, textvariable=self.BrightnesValue) self.Brightnes.grid(row=0, column=0) self.Shutter = Label(frame, textvariable=self.ShutterValue) self.Shutter.grid(row=0, column=1) self.artnetCheckbox = Checkbutton(frame, text="Artnet Control", variable=self.artnet_switch, command=self.checkbox_callback, onvalue=True, offvalue=False) self.artnetCheckbox.grid(row=0, column=2) self.artnetcolorCheckbox = Checkbutton( frame, text="Artnet Color Control", variable=self.artnet_color_switch, command=self.checkbox_color_callback, onvalue=True, offvalue=False) self.artnetcolorCheckbox.grid(row=0, column=3) self.labelG1 = Label(frame, text="Generator A", font=(self.font, "12")) self.labelG1.grid(row=1, column=0) self.labelG2 = Label(frame, text="Generator B", font=(self.font, "12")) self.labelG2.grid(row=1, column=3) self.labelG3 = Label(frame, text="Generator C", font=(self.font, "12")) self.labelG3.grid(row=1, column=6) self.labelE11 = Label(frame, text="Effekt A 1", font=(self.font, "12")) self.labelE11.grid(row=1, column=1) self.labelE12 = Label(frame, text="Effekt B 1", font=(self.font, "12")) self.labelE12.grid(row=1, column=4) self.labelE13 = Label(frame, text="Effekt C 1", font=(self.font, "12")) self.labelE13.grid(row=1, column=7) self.labelE21 = Label(frame, text="Effekt A 2", font=(self.font, "12")) self.labelE21.grid(row=1, column=2) self.labelE22 = Label(frame, text="Effekt B 2", font=(self.font, "12")) self.labelE22.grid(row=1, column=5) self.labelE23 = Label(frame, text="Effekt C 2", font=(self.font, "12")) self.labelE23.grid(row=1, column=8) self.dropdownG1Current = StringVar() self.G1param1String = StringVar() self.G1param2String = StringVar() self.G1param3String = StringVar() self.dropdownG1Current.set(self.generators[0]) # self.dropdownG1 = OptionMenu(frame, self.dropdownG1Current, *self.generators, command = optionmenuG1_selection) self.dropdownG1 = Combobox(frame, values=self.generators) self.dropdownG1.bind("<<ComboboxSelected>>", optionmenuG1_selection) #, command = optionmenuG1_selection) self.dropdownG1.grid(row=2, column=0, sticky="ew") self.G1param1 = Label(frame, textvariable=self.G1param1String, font=(self.font, "12")) self.G1param1.grid(row=3, column=0) self.G1param2 = Label(frame, textvariable=self.G1param2String, font=(self.font, "12")) self.G1param2.grid(row=4, column=0) self.G1param3 = Label(frame, textvariable=self.G1param3String, font=(self.font, "12")) self.G1param3.grid(row=5, column=0) self.dropdownG2Current = StringVar() self.G2param1String = StringVar() self.G2param2String = StringVar() self.G2param3String = StringVar() self.dropdownG2Current.set(self.generators[0]) #self.dropdownG2 = OptionMenu(frame, self.dropdownG2Current, *self.generators,command = optionmenuG2_selection) self.dropdownG2 = Combobox(frame, values=self.generators) self.dropdownG2.bind("<<ComboboxSelected>>", optionmenuG2_selection) self.dropdownG2.grid(row=2, column=3, sticky="ew") self.G2param1 = Label(frame, textvariable=self.G2param1String, font=(self.font, "12")) self.G2param1.grid(row=3, column=3) self.G2param2 = Label(frame, textvariable=self.G2param2String, font=(self.font, "12")) self.G2param2.grid(row=4, column=3) self.G2param3 = Label(frame, textvariable=self.G2param3String, font=(self.font, "12")) self.G2param3.grid(row=5, column=3) self.dropdownG3Current = StringVar() self.G3param1String = StringVar() self.G3param2String = StringVar() self.G3param3String = StringVar() self.dropdownG3Current.set(self.generators[0]) #self.dropdownG3 = OptionMenu(frame, self.dropdownG3Current, *self.generators,command = optionmenuG3_selection) self.dropdownG3 = Combobox(frame, values=self.generators) self.dropdownG3.bind("<<ComboboxSelected>>", optionmenuG3_selection) self.dropdownG3.grid(row=2, column=6, sticky="ew") self.G3param1 = Label(frame, textvariable=self.G3param1String, font=(self.font, "12")) self.G3param1.grid(row=3, column=6) self.G3param2 = Label(frame, textvariable=self.G3param2String, font=(self.font, "12")) self.G3param2.grid(row=4, column=6) self.G3param3 = Label(frame, textvariable=self.G3param3String, font=(self.font, "12")) self.G3param3.grid(row=5, column=6) self.dropdownE11Current = StringVar() self.E11param1String = StringVar() self.E11param2String = StringVar() self.E11param3String = StringVar() self.dropdownE11Current.set(self.effects[0]) self.dropdownE11 = OptionMenu(frame, self.dropdownE11Current, *self.effects, command=optionmenuE11_selection) self.dropdownE11.grid(row=2, column=1, sticky="ew") self.E11param1 = Label(frame, textvariable=self.E11param1String, font=(self.font, "12")) self.E11param1.grid(row=3, column=1) self.E11param2 = Label(frame, textvariable=self.E11param2String, font=(self.font, "12")) self.E11param2.grid(row=4, column=1) self.E11param3 = Label(frame, textvariable=self.E11param3String, font=(self.font, "12")) self.E11param3.grid(row=5, column=1) self.dropdownE12Current = StringVar() self.E12param1String = StringVar() self.E12param2String = StringVar() self.E12param3String = StringVar() self.dropdownE12Current.set(self.effects[0]) self.dropdownE12 = OptionMenu(frame, self.dropdownE12Current, *self.effects, command=optionmenuE12_selection) self.dropdownE12.grid(row=2, column=4, sticky="ew") self.E12param1 = Label(frame, textvariable=self.E12param1String, font=(self.font, "12")) self.E12param1.grid(row=3, column=4) self.E12param2 = Label(frame, textvariable=self.E12param2String, font=(self.font, "12")) self.E12param2.grid(row=4, column=4) self.E12param3 = Label(frame, textvariable=self.E12param3String, font=(self.font, "12")) self.E12param3.grid(row=5, column=4) self.dropdownE13Current = StringVar() self.E13param1String = StringVar() self.E13param2String = StringVar() self.E13param3String = StringVar() self.dropdownE13Current.set(self.effects[0]) self.dropdownE13 = OptionMenu(frame, self.dropdownE13Current, *self.effects, command=optionmenuE13_selection) self.dropdownE13.grid(row=2, column=7, sticky="ew") self.E13param1 = Label(frame, textvariable=self.E13param1String, font=(self.font, "12")) self.E13param1.grid(row=3, column=7) self.E13param2 = Label(frame, textvariable=self.E13param2String, font=(self.font, "12")) self.E13param2.grid(row=4, column=7) self.E13param3 = Label(frame, textvariable=self.E13param3String, font=(self.font, "12")) self.E13param3.grid(row=5, column=7) self.dropdownE21Current = StringVar() self.E21param1String = StringVar() self.E21param2String = StringVar() self.E21param3String = StringVar() self.dropdownE21Current.set(self.effects[0]) self.dropdownE21 = OptionMenu(frame, self.dropdownE21Current, *self.effects, command=optionmenuE21_selection) self.dropdownE21.grid(row=2, column=2, sticky="ew") self.E21param1 = Label(frame, textvariable=self.E21param1String, font=(self.font, "12")) self.E21param1.grid(row=3, column=2) self.E21param2 = Label(frame, textvariable=self.E21param2String, font=(self.font, "12")) self.E21param2.grid(row=4, column=2) self.E21param3 = Label(frame, textvariable=self.E21param3String, font=(self.font, "12")) self.E21param3.grid(row=5, column=2) self.dropdownE22Current = StringVar() self.E22param1String = StringVar() self.E22param2String = StringVar() self.E22param3String = StringVar() self.dropdownE22Current.set(self.effects[0]) self.dropdownE22 = OptionMenu(frame, self.dropdownE22Current, *self.effects, command=optionmenuE22_selection) self.dropdownE22.grid(row=2, column=5, sticky="ew") self.E22param1 = Label(frame, textvariable=self.E22param1String, font=(self.font, "12")) self.E22param1.grid(row=3, column=5) self.E22param2 = Label(frame, textvariable=self.E22param2String, font=(self.font, "12")) self.E22param2.grid(row=4, column=5) self.E22param3 = Label(frame, textvariable=self.E22param3String, font=(self.font, "12")) self.E22param3.grid(row=5, column=5) self.dropdownE23Current = StringVar() self.E23param1String = StringVar() self.E23param2String = StringVar() self.E23param3String = StringVar() self.dropdownE23Current.set(self.effects[0]) self.dropdownE23 = OptionMenu(frame, self.dropdownE23Current, *self.effects, command=optionmenuE23_selection) self.dropdownE23.grid(row=2, column=8, sticky="ew") self.E23param1 = Label(frame, textvariable=self.E23param1String, font=(self.font, "12")) self.E23param1.grid(row=3, column=8) self.E23param2 = Label(frame, textvariable=self.E23param2String, font=(self.font, "12")) self.E23param2.grid(row=4, column=8) self.E23param3 = Label(frame, textvariable=self.E23param3String, font=(self.font, "12")) self.E23param3.grid(row=5, column=8) self.G1BrightnesValue = StringVar() self.G1ShutterValue = StringVar() self.G1FadeValue = StringVar() self.G1Brightnes = Label(frame, textvariable=self.G1BrightnesValue, font=(self.font, "12")) self.G1Brightnes.grid(row=6, column=0) self.G1Shutter = Label(frame, textvariable=self.G1ShutterValue, font=(self.font, "12")) self.G1Shutter.grid(row=7, column=0) self.G1SFade = Label(frame, textvariable=self.G1FadeValue, font=(self.font, "12")) self.G1SFade.grid(row=8, column=0) self.G2BrightnesValue = StringVar() self.G2ShutterValue = StringVar() self.G2FadeValue = StringVar() self.G2Brightnes = Label(frame, textvariable=self.G2BrightnesValue, font=(self.font, "12")) self.G2Brightnes.grid(row=6, column=3) self.G2Shutter = Label(frame, textvariable=self.G2ShutterValue, font=(self.font, "12")) self.G2Shutter.grid(row=7, column=3) self.G2SFade = Label(frame, textvariable=self.G2FadeValue, font=(self.font, "12")) self.G2SFade.grid(row=8, column=3) self.G3BrightnesValue = StringVar() self.G3ShutterValue = StringVar() self.G3FadeValue = StringVar() self.G3Brightnes = Label(frame, textvariable=self.G3BrightnesValue, font=(self.font, "12")) self.G3Brightnes.grid(row=6, column=6) self.G3Shutter = Label(frame, textvariable=self.G3ShutterValue, font=(self.font, "12")) self.G3Shutter.grid(row=7, column=6) self.G2SFade = Label(frame, textvariable=self.G3FadeValue, font=(self.font, "12")) self.G2SFade.grid(row=8, column=6)