def create_widgets(self): figureFrame = tk.Frame(self) figureFrame.grid(row=0, column=0) # Create the Figure and Canvas self.dpi = 100 self.fig = Figure((5.0, 5.0), dpi=self.dpi) self.canvas = FigureCanvasTkAgg(self.fig, master=figureFrame) self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1) # Create the navigation toolbar, tied to the canvas self.mpl_toolbar = NavigationToolbar2TkAgg(self.canvas, figureFrame) self.mpl_toolbar.update() self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1) # Create frame for comboboxes self.selectFrame = tk.Frame(self) self.selectFrame.grid(row=1, column=0, sticky=tk.W + tk.E) # Tally selection labelTally = tk.Label(self.selectFrame, text='Tally:') labelTally.grid(row=0, column=0, sticky=tk.W) self.tallyBox = ttk.Combobox(self.selectFrame, state='readonly') self.tallyBox['values'] = [ self.datafile.tallies[i].id for i in self.meshTallies ] self.tallyBox.current(0) self.tallyBox.grid(row=0, column=1, sticky=tk.W + tk.E) self.tallyBox.bind('<<ComboboxSelected>>', self.update) # Planar basis selection labelBasis = tk.Label(self.selectFrame, text='Basis:') labelBasis.grid(row=1, column=0, sticky=tk.W) self.basisBox = ttk.Combobox(self.selectFrame, state='readonly') self.basisBox['values'] = ('xy', 'yz', 'xz') self.basisBox.current(0) self.basisBox.grid(row=1, column=1, sticky=tk.W + tk.E) self.basisBox.bind('<<ComboboxSelected>>', self.update) # Axial level labelAxial = tk.Label(self.selectFrame, text='Axial level:') labelAxial.grid(row=2, column=0, sticky=tk.W) self.axialBox = ttk.Combobox(self.selectFrame, state='readonly') self.axialBox.grid(row=2, column=1, sticky=tk.W + tk.E) self.axialBox.bind('<<ComboboxSelected>>', self.redraw) # Option for mean/uncertainty labelMean = tk.Label(self.selectFrame, text='Mean/Uncertainty:') labelMean.grid(row=3, column=0, sticky=tk.W) self.meanBox = ttk.Combobox(self.selectFrame, state='readonly') self.meanBox['values'] = ('Mean', 'Absolute uncertainty', 'Relative uncertainty') self.meanBox.current(0) self.meanBox.grid(row=3, column=1, sticky=tk.W + tk.E) self.meanBox.bind('<<ComboboxSelected>>', self.update) # Scores labelScore = tk.Label(self.selectFrame, text='Score:') labelScore.grid(row=4, column=0, sticky=tk.W) self.scoreBox = ttk.Combobox(self.selectFrame, state='readonly') self.scoreBox.grid(row=4, column=1, sticky=tk.W + tk.E) self.scoreBox.bind('<<ComboboxSelected>>', self.redraw) # Filter label font = tkFont.Font(weight='bold') labelFilters = tk.Label(self.selectFrame, text='Filters:', font=font) labelFilters.grid(row=5, column=0, sticky=tk.W)
def create_widgets(self): # ### Frames ########################################################## # the left one contains buttons, filters and displays table with numerical data # the right one contains map self.left_frame = tk.Frame(self.master, highlightbackground="red", highlightcolor="red", borderwidth=2) self.right_frame = tk.Frame(self.master) self.left_frame.pack(side='left', anchor='n') self.right_frame.pack(side='right') # ### Buttons ######################################################### self.button_load = tk.Button(self.left_frame, text="Load flights", command=self.load_flights) self.button_next = tk.Button(self.left_frame, text="Next", command=self.show_next_flight) self.button_previous = tk.Button(self.left_frame, text="Previous", command=self.show_previous_flight) # ### Labels ########################################################## label_filters = tk.Label(self.left_frame, text="Filters", font=('Helvetica', 14, 'bold')) label_calendar = tk.Label(self.left_frame, text="Pick a date") label_calendar_note = tk.Label( self.left_frame, text="Data is available only for July 2018", fg='brown') label_ades = tk.Label(self.left_frame, text="ADES") label_adep = tk.Label(self.left_frame, text="ADEP") label_ncp = tk.Label(self.left_frame, text="NCP") label_wpt = tk.Label(self.left_frame, text="WPT") label_entry_type = tk.Label(self.left_frame, text="Entry type") label_exit_type = tk.Label(self.left_frame, text="Exit type") # ### Calendar ######################################################## self.calendar = tkcalendar.DateEntry(self.left_frame, year=2018, month=7, day=1, width=8) # ### Comboboxes ###################################################### ades_var = tk.StringVar(self.left_frame) adep_var = tk.StringVar(self.left_frame) ncp_var = tk.StringVar(self.left_frame) wpt_var = tk.StringVar(self.left_frame) ades_var.set(self.ades_list[0]) ncp_var.set(self.ncp_list[0]) wpt_var.set(self.wpt_list[0]) self.combobox_ades = ttk.Combobox(self.left_frame, textvariable=ades_var, values=self.ades_list, width=8) self.combobox_adep = ttk.Combobox(self.left_frame, textvariable=adep_var, values=self.adep_list, width=8) self.combobox_ncp = ttk.Combobox(self.left_frame, textvariable=ncp_var, values=self.ncp_list, width=8) self.combobox_wpt = ttk.Combobox(self.left_frame, textvariable=wpt_var, values=self.wpt_list, width=8) # ### Radiobuttons #################################################### self.entry_var = tk.StringVar(self.left_frame) self.entry_var.set('Any') entry_options = ['Any', 'Lateral', 'Vertical'] radiobutton_entry_a = tk.Radiobutton(self.left_frame, text=entry_options[0], variable=self.entry_var, value=entry_options[0]) radiobutton_entry_l = tk.Radiobutton(self.left_frame, text=entry_options[1], variable=self.entry_var, value=entry_options[1]) radiobutton_entry_v = tk.Radiobutton(self.left_frame, text=entry_options[2], variable=self.entry_var, value=entry_options[2]) self.exit_var = tk.StringVar(self.left_frame) self.exit_var.set('Any') exit_options = ['Any', 'Lateral', 'Vertical'] radiobutton_exit_a = tk.Radiobutton(self.left_frame, text=exit_options[0], variable=self.exit_var, value=exit_options[0]) radiobutton_exit_l = tk.Radiobutton(self.left_frame, text=exit_options[1], variable=self.exit_var, value=exit_options[1]) radiobutton_exit_v = tk.Radiobutton(self.left_frame, text=exit_options[2], variable=self.exit_var, value=exit_options[2]) # ### Add widgets ##################################################### label_filters.grid(row=1, column=1, sticky='w') label_calendar.grid(row=2, column=0) self.calendar.grid(row=2, column=1) label_calendar_note.grid(row=3, column=0, columnspan=2) label_ades.grid(row=4, column=0) label_adep.grid(row=5, column=0) label_ncp.grid(row=6, column=0) label_wpt.grid(row=7, column=0) self.button_load.grid(row=8, column=0, sticky='ew') self.button_next.grid(row=8, column=1, sticky='ew') self.button_previous.grid(row=8, column=2, sticky='ew') self.combobox_ades.grid(row=4, column=1) self.combobox_adep.grid(row=5, column=1) self.combobox_ncp.grid(row=6, column=1) self.combobox_wpt.grid(row=7, column=1) label_entry_type.grid(row=2, column=2) label_exit_type.grid(row=3, column=2) radiobutton_entry_a.grid(row=2, column=3) radiobutton_entry_l.grid(row=2, column=4) radiobutton_entry_v.grid(row=2, column=5) radiobutton_exit_a.grid(row=3, column=3) radiobutton_exit_l.grid(row=3, column=4) radiobutton_exit_v.grid(row=3, column=5)
def __init__(self, master): # set up the main frame self.parent = master self.parent.title("LabelTool") self.frame = Frame(self.parent) self.frame.pack(fill=BOTH, expand=1) #self.parent.resizable(width = FALSE, height = FALSE) # initialize global state self.imageDir = '' self.imageList = [] self.egDir = '' self.egList = [] self.outDir = '' self.cur = 0 self.total = 0 self.category = 0 self.imagename = '' self.labelfilename = '' self.tkimg = None self.currentLabelclass = '' self.cla_can_temp = [] self.classcandidate_filename = 'class.txt' # initialize mouse state self.STATE = {} self.STATE['click'] = 0 self.STATE['x'], self.STATE['y'] = 0, 0 # reference to bbox self.bboxIdList = [] self.bboxId = None self.bboxList = [] self.hl = None self.vl = None # ----------------- GUI stuff --------------------- # dir entry & load self.label = Label(self.frame, text="Image Dir:") self.label.grid(row=0, column=0, sticky=E) self.entry = Entry(self.frame) self.entry.grid(row=0, column=1, sticky=W + E) self.ldBtn = Button(self.frame, text="Load", command=self.loadDir) self.ldBtn.grid(row=0, column=2, sticky=W + E) # main panel for labeling self.mainPanel = Canvas(self.frame, cursor='tcross') self.mainPanel.bind("<Button-1>", self.mouseClick) self.mainPanel.bind("<Motion>", self.mouseMove) self.parent.bind( "<Escape>", self.cancelBBox) # press <Espace> to cancel current bbox self.parent.bind("s", self.cancelBBox) self.parent.bind("a", self.prevImage) # press 'a' to go backforward self.parent.bind("d", self.nextImage) # press 'd' to go forward self.mainPanel.grid(row=1, column=1, rowspan=4, sticky=W + N) # choose class self.classname = StringVar() self.classcandidate = ttk.Combobox(self.frame, state='readonly', textvariable=self.classname) self.classcandidate.grid(row=1, column=2) if os.path.exists(self.classcandidate_filename): with open(self.classcandidate_filename) as cf: for line in cf.readlines(): # print line self.cla_can_temp.append(line.strip('\n')) #print self.cla_can_temp self.classcandidate['values'] = self.cla_can_temp self.classcandidate.current(0) self.currentLabelclass = self.classcandidate.get() #init self.btnclass = Button(self.frame, text='ComfirmClass', command=self.setClass) self.btnclass.grid(row=2, column=2, sticky=W + E) # showing bbox info & delete bbox self.lb1 = Label(self.frame, text='Bounding boxes:') self.lb1.grid(row=3, column=2, sticky=W + N) self.listbox = Listbox(self.frame, width=22, height=12) self.listbox.grid(row=4, column=2, sticky=N + S) self.btnDel = Button(self.frame, text='Delete', command=self.delBBox) self.btnDel.grid(row=5, column=2, sticky=W + E + N) self.btnClear = Button(self.frame, text='ClearAll', command=self.clearBBox) self.btnClear.grid(row=6, column=2, sticky=W + E + N) # control panel for image navigation self.ctrPanel = Frame(self.frame) self.ctrPanel.grid(row=7, column=1, columnspan=2, sticky=W + E) self.prevBtn = Button(self.ctrPanel, text='<< Prev', width=10, command=self.prevImage) self.prevBtn.pack(side=LEFT, padx=5, pady=3) self.nextBtn = Button(self.ctrPanel, text='Next >>', width=10, command=self.nextImage) self.nextBtn.pack(side=LEFT, padx=5, pady=3) self.progLabel = Label(self.ctrPanel, text="Progress: / ") self.progLabel.pack(side=LEFT, padx=5) self.tmpLabel = Label(self.ctrPanel, text="Go to Image No.") self.tmpLabel.pack(side=LEFT, padx=5) self.idxEntry = Entry(self.ctrPanel, width=5) self.idxEntry.pack(side=LEFT) self.goBtn = Button(self.ctrPanel, text='Go', command=self.gotoImage) self.goBtn.pack(side=LEFT) # example pannel for illustration self.egPanel = Frame(self.frame, border=10) self.egPanel.grid(row=1, column=0, rowspan=5, sticky=N) self.tmpLabel2 = Label(self.egPanel, text="Examples:") self.tmpLabel2.pack(side=TOP, pady=5) self.egLabels = [] for i in range(3): self.egLabels.append(Label(self.egPanel)) self.egLabels[-1].pack(side=TOP) # display mouse position self.disp = Label(self.ctrPanel, text='') self.disp.pack(side=RIGHT) self.frame.columnconfigure(1, weight=1) self.frame.rowconfigure(4, weight=1)
def __init__(self, parent, controller): self.maincatdict = {} self.combotagdict = {} tk.Frame.__init__(self, parent) self.controller = controller tk.Label(self, text="This is the start page", font=TITLE_FONT) self.pack() # Menu Select Area self.labelmenucontainer = MenuContainer(self, controller) self.labelmenucontainer.grid(column=0, row=6, columnspan=5, sticky='ew') # Display Count labelcountcontainer = tk.LabelFrame(self, text="Count") labelcountcontainer.grid(column=5, row=0, rowspan=2, sticky='ew') self.countlabel = tk.Label(labelcountcontainer, text="#") self.countlabel.grid(column=0, row=0) # Display Selected labelselectcontainer = tk.LabelFrame(self, text="Selected") labelselectcontainer.grid(column=3, row=0, rowspan=2, sticky='ew') self.selectlabel = tk.Label(labelselectcontainer, text="#") self.selectlabel.grid(column=0, row=0) # Display Progress self.labelprogresscontainer = tk.LabelFrame(self, text="Progress") self.labelprogresscontainer.grid(column=2, row=0, rowspan=2, sticky='ew') self.progresslabel = tk.Label(self.labelprogresscontainer, text="#") self.progresslabel.grid(column=0, row=0) # Action Item Buttons labelactioncontainer = tk.LabelFrame(self, text="Action") labelactioncontainer.grid(column=0, row=2, rowspan=2, sticky='ns') buttonsearch = tk.Button(labelactioncontainer, text='Search') buttonsearch.bind('<Button-1>', self.load_listbox) playv = ttk.Button(labelactioncontainer, text="PlayV") playv.bind('<Button-1>', controller.open_file) buttonhashfiles = ttk.Button(labelactioncontainer, text='Refresh Files') buttonhashfiles.bind('<Button-1>', self.refresh_files) buttonsearch.grid(column=0, row=2, sticky='ew', in_=labelactioncontainer) buttonhashfiles.grid(column=0, row=5, sticky='ew', in_=labelactioncontainer) playv.grid(column=0, row=4, sticky='ew', in_=labelactioncontainer) # ----------------------------------------------------------------# # Search Area ##------------------------------------------------# labelactioncontainer = tk.LabelFrame(self, text="Search") labelactioncontainer.grid(column=1, row=2, rowspan=2, sticky='ns') self.entryfield = ttk.Entry(labelactioncontainer, ) self.entryfield.grid(column=1, row=2, in_=labelactioncontainer) self.combosearchtype = ttk.Combobox(labelactioncontainer) self.combosearchtype.grid(column=1, row=3, sticky="ew", in_=labelactioncontainer) # ----------------------------------------------------------------# # # Tag Add/Remove ##------------------------------------------------# labeltagactioncontainer = tk.LabelFrame(self, text="Add/Remove Tag") labeltagactioncontainer.grid(column=2, row=4, rowspan=2, sticky='ns') buttonaddtag = ttk.Button(labeltagactioncontainer, text='Add Tag') buttonaddtag.bind('<Button-1>', self.link_tag2file) buttonremovetag = ttk.Button(labeltagactioncontainer, text='Remove Tag') buttonremovetag.bind('<Button-1>', self.remove_tag) buttonaddtag.grid(column=2, row=4, in_=labeltagactioncontainer) buttonremovetag.grid(column=3, row=4, in_=labeltagactioncontainer) label_auto_tag_container = tk.LabelFrame(self, text="") label_auto_tag_container.grid(column=5, row=2, rowspan=2, sticky='ns') btn_auto_tag = ttk.Button(label_auto_tag_container, text='Auto Tag') btn_auto_tag.bind('<Button-1>', self.auto_tag_filter) btn_auto_tag_db = ttk.Button(label_auto_tag_container, text='Auto Tag DB') btn_auto_tag_db.bind('<Button-1>', self.auto_tag_db) label_combo_main_tag_container = tk.LabelFrame(self, text="") label_combo_main_tag_container.grid(column=2, row=2, columnspan=2, sticky='ns') label_combo_main_container = tk.LabelFrame( label_combo_main_tag_container, text="Category") label_combo_main_container.grid(column=2, row=2, columnspan=2, sticky='ns') self.comboMain = ttk.Combobox(label_combo_main_container) self.comboMain.bind('<<ComboboxSelected>>', controller.maincat_combo_change) self.comboMain.grid(column=0, row=0, columnspan=2, sticky="ew", in_=label_combo_main_container) labelcombotagcontainer = tk.LabelFrame(label_combo_main_tag_container, text="Tag") labelcombotagcontainer.grid(column=2, row=3, columnspan=2, sticky='ns') self.combo01 = ttk.Combobox(labelcombotagcontainer) self.combo01.grid(column=2, row=1, columnspan=2, sticky="ew", in_=labelcombotagcontainer) self.combo01.bind('<KeyRelease>', controller.find_combo_value) btn_auto_tag.grid(column=5, row=2, in_=label_auto_tag_container) btn_auto_tag_db.grid(column=5, row=3, in_=label_auto_tag_container)
def initPanedWindow(self): #self.paned_window = PanedWindow(bg="green") self.paned_window = PanedWindow() self.paned_window.pack(fill=BOTH, expand=1) self.leftPaneComponents() self.top_paned_window = PanedWindow(self.paned_window, orient=VERTICAL) self.paned_window.add(self.top_paned_window) top_frame = ttk.Frame(self.top_paned_window) nav_buttons = ['<<', '<', '>', '>>'] #for b in nav_buttons: for b in self.navs: self.images_navs[b] = PhotoImage(file=str('images/%s.png' % (b))) btn_nav = Button(top_frame, image=self.images_navs[b], text=b, relief=GROOVE, justify=CENTER, command=lambda tag=b: self.doClickEvent(0, tag)) #btn_nav = Button(top_frame, text= b,relief=GROOVE) btn_nav.pack(side=LEFT, padx=0, pady=0) top_frame.pack(fill=X, padx=200) self.top_paned_window.add(top_frame) cbox_CountPage = ttk.Combobox(top_frame, textvariable=self.count_page, state="readonly", width=4) cbox_CountPage.bind('<Return>') cbox_CountPage['values'] = ('All', '10', '25', '50', '75', '100', '150', '200') cbox_CountPage.current(0) cbox_CountPage.pack(side=LEFT, padx=1, pady=1) lbl_Search = Label(top_frame, text="Search:") lbl_Search.pack(side=LEFT, padx=1, pady=1) txt_Search = Entry(top_frame, text='Keyword', textvariable=self.search_keyword) txt_Search.pack(side=LEFT, padx=1, pady=1) btn_Search = Button( top_frame, text='Find', image=self.img_find, relief=GROOVE, justify=CENTER, command=lambda tag='Find': self.doClickEvent(0, tag)) btn_Search.pack(side=LEFT, padx=1, pady=1) lbl_Filter = Label(top_frame, text="Filter:") lbl_Filter.pack(side=LEFT, padx=1, pady=1) cbox_Filter = ttk.Combobox(top_frame, textvariable=self.filter, state="readonly", width=10) cbox_Filter.bind('<Return>') cbox_Filter['values'] = self.date_filter #cbox_Filter.current(0) cbox_Filter.pack(side=LEFT, padx=1, pady=1) #cbox_Filter.grid(row=1, column=1, columnspan=7, sticky="WE", pady=3) btn_Filter = Button( top_frame, text='Filter', image=self.img_filter, relief=GROOVE, justify=CENTER, command=lambda tag='Filter': self.doClickEvent(0, tag)) btn_Filter.pack(side=LEFT, padx=1, pady=1) btn_FilterAdvanced = Button( top_frame, text='Filter Advanced', image=self.img_filter_advanced, relief=GROOVE, justify=CENTER, command=lambda tag='Filter Advanced': self.doClickEvent(0, tag)) btn_FilterAdvanced.pack(side=LEFT, padx=1, pady=1) label = Label(top_frame, textvariable=self.rows_count, bd=1, relief=FLAT, anchor=W) self.rows_count.set('15 of 40') label.pack(side=LEFT, fill=X) self.initTable()
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.',background=_bgcolor) self.style.configure('.',foreground=_fgcolor) self.style.configure('.',font="TkDefaultFont") self.style.map('.',background= [('selected', _compcolor), ('active',_ana2color)]) top.geometry("1280x686+280+126") top.minsize(120, 1) top.maxsize(3004, 1913) top.resizable(1, 1) top.title("New Toplevel") top.configure(background="#000040") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="#000000") movname=tk.StringVar() descr=tk.StringVar() age_rating=tk.StringVar() rating=tk.StringVar() genre=tk.StringVar() poster=tk.StringVar() cast=tk.StringVar() self.menubar = tk.Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor) top.configure(menu = self.menubar) self.TSeparator3 = ttk.Separator(top) self.TSeparator3.place(relx=0.165, rely=0.168, relheight=0.845) self.TSeparator3.configure(orient="vertical") self.TSeparator4 = ttk.Separator(top) self.TSeparator4.place(relx=0.818, rely=0.168, relheight=0.835) self.TSeparator4.configure(orient="vertical") img = ImageTk.PhotoImage(PIL.Image.open("Logo.png").resize((90, 90), PIL.Image.ANTIALIAS)) #img = ImageTk.PhotoImage(file="Logo.png") self.Logo_image = tk.Label(top) self.Logo_image.place(relx=0.172, rely=0.015, height=92, width=124) self.Logo_image.configure(image=img) self.Logo_image=img self.Title_l = tk.Label(top) self.Title_l.place(relx=0.359, rely=0.044, height=61, width=372) self.Title_l.configure(activebackground="#f9f9f9") self.Title_l.configure(activeforeground="black") self.Title_l.configure(background="#000040") self.Title_l.configure(disabledforeground="#a3a3a3") self.Title_l.configure(font="-family {Segoe UI} -size 22") self.Title_l.configure(foreground="#ffffff") self.Title_l.configure(highlightbackground="#d9d9d9") self.Title_l.configure(highlightcolor="black") self.Title_l.configure(text='''Theatre Buzz Admin Page''') self.Movie_l = tk.Label(top) self.Movie_l.place(relx=0.203, rely=0.204, height=31, width=284) self.Movie_l.configure(activebackground="#f9f9f9") self.Movie_l.configure(activeforeground="black") self.Movie_l.configure(anchor='w') self.Movie_l.configure(background="#000040") self.Movie_l.configure(disabledforeground="#a3a3a3") self.Movie_l.configure(font="-family {Segoe UI} -size 13") self.Movie_l.configure(foreground="#ffffff") self.Movie_l.configure(highlightbackground="#d9d9d9") self.Movie_l.configure(highlightcolor="black") self.Movie_l.configure(text='''Enter Movie name:''') self.Desc_l = tk.Label(top) self.Desc_l.place(relx=0.203, rely=0.335, height=31, width=284) self.Desc_l.configure(activebackground="#f9f9f9") self.Desc_l.configure(activeforeground="black") self.Desc_l.configure(anchor='w') self.Desc_l.configure(background="#000040") self.Desc_l.configure(disabledforeground="#a3a3a3") self.Desc_l.configure(font="-family {Segoe UI} -size 13") self.Desc_l.configure(foreground="#ffffff") self.Desc_l.configure(highlightbackground="#d9d9d9") self.Desc_l.configure(highlightcolor="black") self.Desc_l.configure(text='''Enter description:''') self.Moviename_e = tk.Entry(top, textvariable=movname) self.Moviename_e.place(relx=0.203, rely=0.262, height=30, relwidth=0.222) self.Moviename_e.configure(background="white") self.Moviename_e.configure(disabledforeground="#a3a3a3") self.Moviename_e.configure(font="TkFixedFont") self.Moviename_e.configure(foreground="#000000") self.Moviename_e.configure(highlightbackground="#d9d9d9") self.Moviename_e.configure(highlightcolor="black") self.Moviename_e.configure(insertbackground="black") self.Moviename_e.configure(selectbackground="blue") self.Moviename_e.configure(selectforeground="white") self.Desc_e = tk.Entry(top, textvariable=descr) self.Desc_e.place(relx=0.203, rely=0.394, height=30, relwidth=0.222) self.Desc_e.configure(background="white") self.Desc_e.configure(disabledforeground="#a3a3a3") self.Desc_e.configure(font="TkFixedFont") self.Desc_e.configure(foreground="#000000") self.Desc_e.configure(highlightbackground="#d9d9d9") self.Desc_e.configure(highlightcolor="black") self.Desc_e.configure(insertbackground="black") self.Desc_e.configure(selectbackground="blue") self.Desc_e.configure(selectforeground="white") self.rating_l = tk.Label(top) self.rating_l.place(relx=0.203, rely=0.466, height=31, width=284) self.rating_l.configure(activebackground="#f9f9f9") self.rating_l.configure(activeforeground="black") self.rating_l.configure(anchor='w') self.rating_l.configure(background="#000040") self.rating_l.configure(cursor="hand2") self.rating_l.configure(disabledforeground="#a3a3a3") self.rating_l.configure(font="-family {Segoe UI} -size 13") self.rating_l.configure(foreground="#ffffff") self.rating_l.configure(highlightbackground="#d9d9d9") self.rating_l.configure(highlightcolor="black") self.rating_l.configure(text='''Enter Rating:''') self.cast_l = tk.Label(top) self.cast_l.place(relx=0.203, rely=0.554, height=31, width=284) self.cast_l.configure(activebackground="#f9f9f9") self.cast_l.configure(activeforeground="black") self.cast_l.configure(anchor='w') self.cast_l.configure(background="#000040") self.cast_l.configure(disabledforeground="#a3a3a3") self.cast_l.configure(font="-family {Segoe UI} -size 13") self.cast_l.configure(foreground="#ffffff") self.cast_l.configure(highlightbackground="#d9d9d9") self.cast_l.configure(highlightcolor="black") self.cast_l.configure(text='''Enter Cast:''') self.cast_e = tk.Entry(top, textvariable=cast) self.cast_e.place(relx=0.203, rely=0.612, height=30, relwidth=0.222) self.cast_e.configure(background="white") self.cast_e.configure(disabledforeground="#a3a3a3") self.cast_e.configure(font="TkFixedFont") self.cast_e.configure(foreground="#000000") self.cast_e.configure(highlightbackground="#d9d9d9") self.cast_e.configure(highlightcolor="black") self.cast_e.configure(insertbackground="black") self.cast_e.configure(selectbackground="blue") self.cast_e.configure(selectforeground="white") self.Agerating_l = tk.Label(top) self.Agerating_l.place(relx=0.203, rely=0.685, height=31, width=284) self.Agerating_l.configure(activebackground="#f9f9f9") self.Agerating_l.configure(activeforeground="black") self.Agerating_l.configure(anchor='w') self.Agerating_l.configure(background="#000040") self.Agerating_l.configure(disabledforeground="#a3a3a3") self.Agerating_l.configure(font="-family {Segoe UI} -size 13") self.Agerating_l.configure(foreground="#ffffff") self.Agerating_l.configure(highlightbackground="#d9d9d9") self.Agerating_l.configure(highlightcolor="black") self.Agerating_l.configure(text='''Enter Age Rating:''') self.Genre_l = tk.Label(top) self.Genre_l.place(relx=0.203, rely=0.758, height=33, width=111) self.Genre_l.configure(activebackground="#f9f9f9") self.Genre_l.configure(activeforeground="black") self.Genre_l.configure(anchor='w') self.Genre_l.configure(background="#000040") self.Genre_l.configure(disabledforeground="#a3a3a3") self.Genre_l.configure(cursor="hand2") self.Genre_l.configure(font="-family {Segoe UI} -size 13") self.Genre_l.configure(foreground="#ffffff") self.Genre_l.configure(highlightbackground="#d9d9d9") self.Genre_l.configure(highlightcolor="black") self.Genre_l.configure(text='''Enter Genre:''') self.RatingSpinbox1 = tk.Spinbox(top, from_=1.0, to=5.0) self.RatingSpinbox1.place(relx=0.305, rely=0.481, relheight=0.044 , relwidth=0.034) self.RatingSpinbox1.configure(activebackground="#f9f9f9") self.RatingSpinbox1.configure(background="white") self.RatingSpinbox1.configure(buttonbackground="#d9d9d9") self.RatingSpinbox1.configure(disabledforeground="#a3a3a3") self.RatingSpinbox1.configure(font="TkDefaultFont") self.RatingSpinbox1.configure(foreground="black") self.RatingSpinbox1.configure(highlightbackground="black") self.RatingSpinbox1.configure(highlightcolor="black") self.RatingSpinbox1.configure(insertbackground="black") self.RatingSpinbox1.configure(selectbackground="blue") self.RatingSpinbox1.configure(selectforeground="white") self.ageratingcombo = ttk.Combobox(top, textvariable=age_rating) self.ageratingcombo.place(relx=0.336, rely=0.685, relheight=0.045 , relwidth=0.088) self.ageratingcombo.configure(font="-family {Segoe UI} -size 12") self.ageratingcombo.configure(takefocus="") self.ageratingcombo['values']=('U', 'U/A', 'A') self.ageratingcombo.current(1) self.Genrecombo = ttk.Combobox(top, textvariable= genre) self.Genrecombo.place(relx=0.336, rely=0.758, relheight=0.045 , relwidth=0.088) self.Genrecombo.configure(takefocus="") self.Genrecombo['values']=('Horror', 'Comedy', 'Action','Suspense', 'Drama') self.Genrecombo.current(1) self.Poster_l = tk.Label(top) self.Poster_l.place(relx=0.500, rely=0.335, height=31, width=284) self.Poster_l.configure(activebackground="#f9f9f9") self.Poster_l.configure(activeforeground="black") self.Poster_l.configure(anchor='w') self.Poster_l.configure(background="#000040") self.Poster_l.configure(disabledforeground="#a3a3a3") self.Poster_l.configure(font="-family {Segoe UI} -size 13") self.Poster_l.configure(foreground="#ffffff") self.Poster_l.configure(highlightbackground="#d9d9d9") self.Poster_l.configure(highlightcolor="black") self.Poster_l.configure(text='''Enter Poster''') self.Poster_e = tk.Entry(top, textvariable=poster) self.Poster_e.place(relx=0.500, rely=0.394, height=30, relwidth=0.222) self.Poster_e.configure(background="white") self.Poster_e.configure(disabledforeground="#a3a3a3") self.Poster_e.configure(font="TkFixedFont") self.Poster_e.configure(foreground="#000000") self.Poster_e.configure(highlightbackground="#d9d9d9") self.Poster_e.configure(highlightcolor="black") self.Poster_e.configure(insertbackground="black") self.Poster_e.configure(selectbackground="blue") self.Poster_e.configure(selectforeground="white") self.Createuser_b = tk.Button(top, command=lambda: ins(movname, descr, cast, poster, self.RatingSpinbox1, self.ageratingcombo, self.Genrecombo)) self.Createuser_b.place(relx=0.594, rely=0.7, height=84, width=207) self.Createuser_b.configure(activebackground="#ececec") self.Createuser_b.configure(activeforeground="#000000") self.Createuser_b.configure(background="#77eaea") self.Createuser_b.configure(disabledforeground="#a3a3a3") self.Createuser_b.configure(cursor="hand2") self.Createuser_b.configure(font="-family {Segoe UI} -size 23") self.Createuser_b.configure(foreground="#000000") self.Createuser_b.configure(highlightbackground="#d9d9d9") self.Createuser_b.configure(highlightcolor="black") self.Createuser_b.configure(pady="0") self.Createuser_b.configure(text='''Create Movie''')
def new(self, caller): global masterr fname = StringVar() mname = StringVar() sname = StringVar() eid = StringVar() cid = StringVar() email = StringVar() contact = StringVar() h_no = StringVar() area = StringVar() city = StringVar() state = StringVar() course_name = StringVar() sem_name = StringVar() stream_name = StringVar() password = StringVar() password1 = StringVar() def save(): def call(frm1): def invoke(): from datasetCreator import datasetcreat datasetcreat(c_id, course__name, sem__no, stream_no) caller.state(newstate="iconic") def invoke1(): from UpperBodyCut import UpperBody UpperBody(c_id, course__name, sem__no, stream_no) caller.state(newstate="iconic") lbl_image.grid_forget() lbl_image1.grid_forget() ibt.grid_forget() ibt1.grid_forget() image = Image.open("pic/fingerprint.jpg") img1 = image.resize((200, 150), Image.ANTIALIAS) img2 = img1.save("pic/fingerprint_new.gif") image = PhotoImage(file="pic/fingerprint_new.gif") lbl_image = Label(frm1) lbl_image["image"] = image lbl_image.grid(row=1, column=1, pady=5, sticky=(NW)) ibt = Button(frm1, width=10, text="Scan", bg="blue", fg="white", command=invoke) ibt.grid(row=2, column=1, sticky=S) image1 = Image.open("fingerprint.jpg") img3 = image1.resize((200, 150), Image.ANTIALIAS) img4 = img3.save("ad3.gif") image1 = PhotoImage(file="ad3.gif") lbl_image1 = Label(frm1) lbl_image1["image"] = image1 lbl_image1.grid(row=3, column=1, pady=4, sticky=(NW)) ibt1 = Button(frm1, width=10, text="Profile", bg="blue", fg="white", command=invoke1) ibt1.grid(row=4, column=1, sticky=S) fnam = fname.get() mnam = mname.get() snam = sname.get() en_id = eid.get() global c_id c_id = cid.get() e_mail = email.get() contact_no = contact.get() house_no = h_no.get() area_name = area.get() city_name = city.get() state_name = state.get() global course__name course__name = course_name.get() global sem__no sem__no = sem_name.get() global stream_no stream_no = stream_name.get() password_2 = password.get() password_1 = password1.get() if (fnam == "" or snam == "" or en_id == "" or c_id == "" or area_name == "" or e_mail == "" or city_name == "" or state_name == "" or course__name == "" or sem__no == "" or password_1 == "" or password_2 == "" or stream_no == "" or contact_no == ""): import tkMessageBox tkMessageBox.showwarning("Warning", " (*) Feild Required") else: if (password_2 != password_1): import tkMessageBox tkMessageBox.showwarning("WARNING", "Incorrect Password") else: import datetime now = datetime.datetime.now() reg_date = str( str(now.day) + "-" + str(now.month) + "-" + str(now.year)) reg_time = str( str(now.hour) + ":" + str(now.minute) + ":" + str(now.second)) import mysql.connector cnx = mysql.connector.connect(user='******', password='******', host='127.0.0.1', database='project') if (cnx): cursor = cnx.cursor() try: q2 = ("select * from sregister where email=%s") data2 = (str(e_mail), ) cursor.execute(q2, data2) r = cursor.fetchone() cnx.commit() if (r): import tkMessageBox tkMessageBox.showinfo("OK", "Already Exist") else: q = "insert into sregister (fname,mname,sname,eid,cid,email,h_no,area,city,state,course,sem,password,regdate,regtime,stream,contact) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)" data = (str(fnam.upper()), str(mnam.upper()), str(snam.upper()), str(en_id.upper()), str(c_id.upper()), str(e_mail), str(house_no), str(area_name.upper()), str(city_name.upper()), str(state_name.upper()), str(course__name), str(sem__no), str(password_2), str(reg_date), str(reg_time), str(stream_no), str(contact_no)) cursor.execute(q, data) cnx.commit() t = cursor.rowcount q1 = "insert into attendance_m (cid,mark) VALUES (%s,%s)" data1 = (str(c_id.upper()), int(0)) cursor.execute(q1, data1) cnx.commit() t1 = cursor.rowcount if (int(t) >= 1 and int(t1) >= 1): import tkMessageBox tkMessageBox.showinfo( "OK", "Registerd Successfully") call(frm1) except Exception as e: print(str(type(e)) + str(e)) cursor.close() cnx.close() fname.set("") mname.set("") sname.set("") eid.set("") cid.set("") email.set("") contact.set("") h_no.set("") area.set("") city.set("") state.set("") course_name.set("") sem_name.set("") stream_name.set("") password.set("") password1.set("") masterr = Toplevel(caller) masterr.title("STUDENT REGISTRATION") masterr.configure(height=650, width=900, bg="#990066") masterr.minsize(height=650, width=900) masterr.maxsize(height=650, width=900) f = tkFont.Font(size=15, weight="bold", family="Helvetica") frm1 = Frame(masterr, height=630, width=200, bg="#990066") frm1.grid(row=1, column=1, padx=10, pady=58, sticky=N) ## image1 = Image.open("fingerprint.jpg") ## img3=image1.resize((200,150),Image.ANTIALIAS) ## img4=img3.save("ad3.gif") ## ## image1 = PhotoImage(file="ad3.gif") ## lbl_image1 = Label(frm1) ## lbl_image1["image"] = image1 ## lbl_image1.grid(row=3, column=1,pady=4,sticky=(NW)) frm2 = Frame(masterr, height=630, width=660, bg="#990066") frm2.grid(row=1, column=2, padx=10, pady=10, sticky=W + N + S + E) frm3 = Frame(frm2, height=60, width=660, bg="#990066") frm3.grid(row=1, column=1) lbl1 = Label(frm3, font=f, text="STUDENT REGISTRATION", width=58, bg="#990066", fg="gray") lbl1.grid(row=1, column=1, padx=5, pady=5) f1 = tkFont.Font(weight="bold", family="Helvetica") frm4 = Frame(frm2, height=60, width=660, bg="#990066") frm4.grid(row=2, column=1, sticky=W) lbl2 = Label(frm4, text="First Name(*)", fg="gray", bg="#990066") lbl2.grid(row=1, column=1, sticky=W, padx=4, pady=2) Ent1 = Entry(frm4, width=25, textvariable=fname) Ent1.grid(row=2, column=1, sticky=W, padx=4, pady=2) lbl3 = Label(frm4, text="MIddle Name", fg="gray", bg="#990066") lbl3.grid(row=1, column=2, sticky=W, padx=4, pady=2) Ent2 = Entry(frm4, width=25, textvariable=mname) Ent2.grid(row=2, column=2, sticky=W, padx=4, pady=2) lbl4 = Label(frm4, text="Last Name(*)", fg="gray", bg="#990066") lbl4.grid(row=1, column=3, sticky=W, padx=4, pady=2) Ent3 = Entry(frm4, width=25, textvariable=sname) Ent3.grid(row=2, column=3, sticky=W, padx=4, pady=2) lbl5 = Label(frm4, text="Enrollment ID(*)", fg="gray", bg="#990066") lbl5.grid(row=7, column=1, sticky=W, padx=2, pady=2) Ent4 = Entry(frm4, width=25, textvariable=eid) Ent4.grid(row=8, column=1, sticky=W, padx=2, pady=2) lblcid = Label(frm4, text="College ID(*)", fg="gray", bg="#990066") lblcid.grid(row=7, column=2, sticky=W, padx=2, pady=2) Entcid = Entry(frm4, width=25, textvariable=cid) Entcid.grid(row=8, column=2, sticky=W, padx=2, pady=2) lbl6 = Label(frm4, text="Email(*)", fg="gray", bg="#990066") lbl6.grid(row=9, column=1, sticky=W, padx=2, pady=2) Ent5 = Entry(frm4, width=52, textvariable=email) Ent5.grid(row=10, column=1, columnspan=2, sticky=W, padx=2, pady=2) lbl7 = Label(frm4, text="Contact(*)", fg="gray", bg="#990066") lbl7.grid(row=9, column=3, sticky=W, padx=2, pady=2) Ent5 = Entry(frm4, width=25, textvariable=contact) Ent5.grid(row=10, column=3, sticky=W, padx=2, pady=2) lbl6 = LabelFrame(frm4, text="Address", fg="gray", bg="#990066", width=50) lbl6.grid(row=13, column=1, columnspan=2, sticky=W, padx=2, pady=2) lblhome = Label(lbl6, text="House No", fg="gray", bg="#990066") lblhome.grid(row=1, column=1, sticky=W, padx=2, pady=2) Enthome = Entry(lbl6, width=25, textvariable=h_no) Enthome.grid(row=2, column=1, sticky=W, padx=2, pady=2) lblarea = Label(lbl6, text="Area/Landmark(*)", fg="gray", bg="#990066") lblarea.grid(row=3, column=1, sticky=W, padx=2, pady=2) Entarea = Entry(lbl6, width=25, textvariable=area) Entarea.grid(row=4, column=1, sticky=W, padx=2, pady=2) lblcity = Label(lbl6, text="City(*)", fg="gray", bg="#990066") lblcity.grid(row=1, column=2, sticky=W, padx=2, pady=2) Entcity = Entry(lbl6, width=25, textvariable=city) Entcity.grid(row=2, column=2, sticky=W, padx=2, pady=2) lblstate = Label(lbl6, text="State(*)", fg="gray", bg="#990066") lblstate.grid(row=3, column=2, sticky=W, padx=2, pady=2) Entstate = Entry(lbl6, width=25, textvariable=state) Entstate.grid(row=4, column=2, sticky=W, padx=2, pady=2) course = Label(frm4, text="Courses(*)", fg="gray", bg="#990066") course.grid(row=14, column=1, sticky=W, padx=2, pady=2) courses = ttk.Combobox(frm4, state="readonly", textvariable=course_name, values=('BTech', 'MTech')) courses.grid(row=16, column=1, sticky=W, padx=2, pady=2) lblsem = Label(frm4, text="Semester(*)", fg="gray", bg="#990066") lblsem.grid(row=14, column=2, sticky=W, padx=2, pady=2) sem = ttk.Combobox(frm4, state="readonly", textvariable=sem_name, values=('SEMESTER 1', 'SEMESTER 2', 'SEMESTER 3', 'SEMESTER 4', 'SEMESTER 5', 'SEMESTER 6', 'SEMESTER 7', 'SEMESTER 8')) sem.grid(row=16, column=2, sticky=W, padx=2, pady=2) stream = Label(frm4, text="Stream(*)", fg="gray", bg="#990066") stream.grid(row=14, column=3, sticky=W, padx=2, pady=2) sub = ttk.Combobox(frm4, state="readonly", textvariable=stream_name, values=('CS', 'CIVIL', 'IT', 'ECE', 'EIC', 'EE', 'ME')) sub.grid(row=16, column=3, sticky=W, padx=2, pady=2) lbl7 = Label(frm4, text="Password(*)", fg="gray", bg="#990066") lbl7.grid(row=17, column=1, sticky=W, padx=2, pady=2) Ent6 = Entry(frm4, width=25, textvariable=password, show="*") Ent6.grid(row=18, column=1, sticky=W, padx=2, pady=2) lbl6 = Label(frm4, text="Re-Enter Password(*)", fg="gray", bg="#990066") lbl6.grid(row=17, column=2, sticky=W, padx=2, pady=2) Ent5 = Entry(frm4, width=25, textvariable=password1, show="*") Ent5.grid(row=18, column=2, sticky=W, padx=2, pady=2) submit = Button(frm4, width=10, text="Save Details", bg="gray", fg="#990066", command=save) submit.grid(row=19, column=1, sticky=W, padx=2, pady=20) masterr.mainloop()
def __init__(self): self.queue = Queue.Queue() tk.Tk.__init__(self) self.style = ttk.Style() self.style.theme_use("clam") try: self.tree = ET.parse("cabrio-manager.xml") except: sys.exit("Error: cabrio-manager.xml not found, it should be in the same folder that this script.") self.root = self.tree.getroot() self.lang = loc[0] if self.lang == None: self.lang = "en_GB" if self.root.findall(".//*[@code='"+self.lang+"']") == []: self.lang = "en_GB" for lang in self.root.findall(".//*[@code='"+self.lang+"']"): self.titleStr = lang.find("title").text self.tabNewStr = lang.find("tabNew").text self.tabEditStr = lang.find("tabEdit").text self.tabAboutStr = lang.find("tabAbout").text self.convertLabelStr = lang.find("convertLabel").text self.convertButtonStr = lang.find("convertButton").text self.createLabelStr = lang.find("createLabel").text self.createButtonStr = lang.find("createButton").text self.listSelectLabelStr = lang.find("listSelectLabel").text self.listDeleteButtonStr = lang.find("deleteButton").text self.emuEditLabelStr = lang.find("emuEditLabel").text self.aboutLabelStr = lang.find("aboutLabel").text self.versionLabelStr = lang.find("versionLabel").text self.translationLabelStr = lang.find("translationLabel").text self.authorLabelStr = lang.find("authorLabel").text self.path = expanduser('~') + '/.cabrio/' self.title(self.titleStr) self.notebook = ttk.Notebook(self) self.notebook.grid(column=0, row=0) self.create = ttk.Frame(self.notebook) self.edit = ttk.Frame(self.notebook) self.about = ttk.Frame(self.notebook) self.notebook.add(self.create, text=self.tabNewStr) self.notebook.add(self.edit, text=self.tabEditStr) self.notebook.add(self.about, text=self.tabAboutStr) self.convertLabel = ttk.Label(self.create, text=self.convertLabelStr) self.convertLabel.grid(column=0, row=0, sticky="W") self.convertButton = ttk.Button(self.create, text=self.convertButtonStr, command=lambda: self.convertList()) self.convertButton.grid(column=1, row=0, sticky="W") self.createLabel = ttk.Label(self.create, text=self.createLabelStr) self.createLabel.grid(column=0, row=1, sticky="W") self.createButton = ttk.Button(self.create, text=self.createButtonStr, command=lambda: self.createList()) self.createButton.grid(column=1, row=1, sticky="W") self.gameLists = [] self.xmlFiles = [] self.genres = [] self.files = os.listdir(self.path) for file in self.files: if os.path.isfile(self.path+"/"+file): if file.endswith("xml"): tree = ET.parse(self.path+"/"+file) for item in tree.findall(".//game-list"): name = item.find("name") try: self.gameLists.append(name.text) self.xmlFiles.append(tree) for category in item.findall(".//category"): genre = category.find("value").text try: self.genres.index(genre) except: self.genres.append(genre) except: pass self.genres.sort() self.scrollbar = ttk.Scrollbar(self.edit) self.scrollbar.grid(column=5, row=1, sticky="NS") self.gamesListbox = tk.Listbox(self.edit, yscrollcommand = self.scrollbar.set, width=50, selectmode="single") self.gamesListbox.grid(column=0, row=1, columnspan=4, sticky="NESW") self.gamesListbox.bind("<Double-Button-1>", self.editGame) self.scrollbar.config(command=self.gamesListbox.yview) self.emuEditLabel = ttk.Label(self.edit, text=self.emuEditLabelStr) self.emuEditLabel.grid(column=0, row=2, columnspan=4) self.listSelectLabel = ttk.Label(self.edit, text=self.listSelectLabelStr) self.listSelectLabel.grid(column=0, row=0) self.listSelectCombo = ttk.Combobox(self.edit, width=10, values=self.gameLists, state="readonly") self.listSelectCombo.bind("<<ComboboxSelected>>", self.getGames) self.listSelectCombo.grid(column=1, row=0) self.listDeleteButton = ttk.Button(self.edit, text=self.listDeleteButtonStr, command=lambda: self.askConfirmationList()) self.listDeleteButton.grid(column=2, row=0) self.logoFile = tk.PhotoImage(file="cabrio-manager.gif") self.logo = ttk.Label(self.about, image=self.logoFile) self.logo.grid(column=0, row=1, columnspan=3) self.aboutLabel = ttk.Label(self.about, text=self.aboutLabelStr) self.aboutLabel.grid(column=0, row=2, columnspan=3) self.versionLabel = ttk.Label(self.about, text=self.versionLabelStr) self.versionLabel.grid(column=0, row=3, columnspan=3) self.translationLabel = ttk.Label(self.about, text=self.translationLabelStr) self.translationLabel.grid(column=0, row=4, columnspan=3) self.authorLabel = ttk.Label(self.about, text=self.authorLabelStr) self.authorLabel.grid(column=0, row=5, columnspan=3)
def createList(self): for lang in self.root.findall(".//*[@code='"+self.lang+"']"): self.createTitleStr = lang.find("createTitle").text self.browseButtonStr = lang.find("browseButton").text self.listNameLabelStr = lang.find("listNameLabel").text self.platformLabelStr = lang.find("platformLabel").text self.browseRomsLabelStr = lang.find("browseRomsLabel").text self.extensionLabelStr = lang.find("extensionLabel").text self.startButtonStr = lang.find("startButton").text self.errorNoEmulatorStr = lang.find("errorNoEmulator").text self.errorNoListStr = lang.find("errorNoList").text self.errorNoPlatformStr = lang.find("errorNoPlatform").text self.errorNoXMLStr = lang.find("errorNoXML").text self.errorNoRomsStr = lang.find("errorNoRoms").text self.errorNoExtensionStr = lang.find("errorNoExtension").text self.cancelButtonStr = lang.find("cancelButton").text self.configTree = ET.parse(self.path + "config.xml") self.configRoot = self.configTree.getroot() self.platformsList = [] for item in self.configRoot.findall(".//emulator"): platform = item.find("platform") self.platformsList.append(platform.text) self.max = tk.IntVar() self.max.set(100) self.status = tk.StringVar() self.status.set("") self.romPath = tk.StringVar() self.romPath.set("") self.toplevel = tk.Toplevel(self.create) self.wait_visibility(self.toplevel) self.toplevel.grab_set() self.frame = ttk.Frame(self.toplevel, borderwidth=10) self.frame.grid() self.toplevel.title(self.createTitleStr) self.listNameLabel = ttk.Label(self.frame, text=self.listNameLabelStr) self.listNameLabel.grid(column=0, row=1, sticky="W") self.listNameEntry = ttk.Entry(self.frame) self.listNameEntry.grid(column=1, row=1, sticky="W") self.platformLabel = ttk.Label(self.frame, text=self.platformLabelStr) self.platformLabel.grid(column=0, row=2, sticky="W") self.platformCombobox = ttk.Combobox(self.frame, values=self.platformsList, state="readonly") self.platformCombobox.grid(column=1, row=2, sticky="W") self.extensionLabel = ttk.Label(self.frame, text=self.extensionLabelStr) self.extensionLabel.grid(column=0, row=3, sticky="W") self.extensionEntry = ttk.Entry(self.frame) self.extensionEntry.grid(column=1, row=3, sticky="W") self.browseRomsLabel = ttk.Label(self.frame, text=self.browseRomsLabelStr) self.browseRomsLabel.grid(column=0, row=4, sticky="W") self.browseRomsButton = ttk.Button(self.frame, text=self.browseButtonStr, command=lambda: self.getRomPath()) self.browseRomsButton.grid(column=1,row=4, sticky="W") self.browseRomsPath = ttk.Label(self.frame, textvariable=self.romPath) self.browseRomsPath.grid(column=0, row=5, columnspan=4, sticky="W") self.startButton = ttk.Button(self.frame, text=self.startButtonStr, command=lambda: self.checkCreateFields()) self.startButton.grid(column=0, row=6, columnspan=2) self.cancelButton = ttk.Button(self.frame, text=self.cancelButtonStr, command=lambda: self.closeWindow()) self.cancelButton.grid(column=1, row=6) self.progressBar = ttk.Progressbar(self.frame, orient="horizontal", mode="determinate", maximum=self.max.get(), length=500) self.progressBar.grid(column=0, row=7, columnspan=4, sticky="W") self.separator = ttk.Separator(self.frame, orient="horizontal") self.separator.grid(column=0, row=8, columnspan=4, sticky="EW") self.statusLabel = ttk.Label(self.frame, textvariable=self.status) self.statusLabel.grid(column=0, row=9, columnspan=4, sticky="W")
bg='powder blue', justify='right') txttax_rate.grid(row=5, column=1) txttax_rate.bind('<Return>', enter_tax_rate) txttax_rate.bind('<Escape>', escape_tax_rate) lblopen_rate = Label(f1, font=('arial', 16, 'bold'), text='open_rate', bd=16, anchor='w') lblopen_rate.grid(row=0, column=2) #txtopen_rate=Entry(f1,font=('arial',16,'bold'),textvariable=open_rate, bd=10 ,insertwidth=4 ,bg='powder blue', justify ='right') #txtopen_rate.grid(row=0,column=3) combo = ttk.Combobox(f1, font=('arial', 16, 'bold'), textvariable=open_rate, justify='right') combo.grid(row=0, column=3) combo.config(values=("Yes", "No")) combo.bind('<Return>', enter_open_rate) combo.bind('<Escape>', escape_open_rate) f1.option_add("*TCombobox*Background", 'powder blue') lblopening_stock = Label(f1, font=('arial', 16, 'bold'), text='opening_stock', bd=16, anchor='w') lblopening_stock.grid(row=1, column=2) txtopening_stock = Entry(f1, font=('arial', 16, 'bold'),
def createWidgets(self): ## Create button #self.QUIT = Button(self) #self.QUIT["text"] = "QUIT" #self.QUIT["fg"] = "red" #self.QUIT["command"] = self.saveData #self.QUIT.grid(row=0, column=0) ## Team 1 Stuff ## self.team1Lab = Label(self) self.team1Lab["text"] = "Team1" self.team1Lab.grid(row=1, column=0) ## Create combobox self.combo = ttk.Combobox(self) self.combo.bind("<<ComboboxSelected>>", self._updatecb1) self.combo["values"] = (self.teamNames) self.combo.current(0) self.combo.grid(row=1, column=1) ## Goal Add self.team1goaladd = Button(self, width=5) self.team1goaladd["text"] = "+G" self.team1goaladd["command"] = self.team1goalUp self.team1goaladd.grid(row=2, column=2, sticky=S) ## Goal Minus self.team1goalmin = Button(self, width=5) self.team1goalmin["text"] = "-G" self.team1goalmin["command"] = self.team1goalDown self.team1goalmin.grid(row=2, column=3, sticky=S) ## Assist Add self.team1assadd = Button(self, width=5) self.team1assadd["text"] = "+A" self.team1assadd["command"] = self.team1assistUp self.team1assadd.grid(row=3, column=2) ## Assist Minus self.team1assmin = Button(self, width=5) self.team1assmin["text"] = "-A" self.team1assmin["command"] = self.team1assistDown self.team1assmin.grid(row=3, column=3) ## Saves Add self.team1saveadd = Button(self, width=5) self.team1saveadd["text"] = "+S" self.team1saveadd["command"] = self.team1ShotsOnUp self.team1saveadd.grid(row=4, column=2, sticky=N) ## Saves Minus self.team1savemin = Button(self, width=5) self.team1savemin["text"] = "-S" self.team1savemin["command"] = self.team1ShotsOnDown self.team1savemin.grid(row=4, column=3, sticky=N) ## Miss Add self.team1missadd = Button(self, width=5) self.team1missadd["text"] = "+M" self.team1missadd["command"] = self.team1missesUp self.team1missadd.grid(row=5, column=2, sticky=N) ## Miss Minus self.team1missmin = Button(self, width=5) self.team1missmin["text"] = "-M" self.team1missmin["command"] = self.team1missesDown self.team1missmin.grid(row=5, column=3, sticky=N) ## Create player list self.team1list = Listbox(self) for i in (player.getFullName() for player in self.team1.players): self.team1list.insert(END, i) self.team1list.grid(row=2, column=1, rowspan=3, sticky=W + E + N + S) ## Team 2 Stuff ## self.team2Lab = Label(self) self.team2Lab["text"] = "Team2" self.team2Lab.grid(row=1, column=3, sticky=E) ## Create combobox self.combo2 = ttk.Combobox(self) self.combo2.bind("<<ComboboxSelected>>", self._updatecb2) self.combo2["values"] = (self.teamNames) self.combo2.current(1) self.combo2.grid(row=1, column=4) ## Goal Add self.team2goaladd = Button(self, width=5) self.team2goaladd["text"] = "+G" self.team2goaladd["command"] = self.team2goalUp self.team2goaladd.grid(row=2, column=5, sticky=S) ## Goal Minus self.team2goalmin = Button(self, width=5) self.team2goalmin["text"] = "-G" self.team2goalmin["command"] = self.team2goalDown self.team2goalmin.grid(row=2, column=6, sticky=S) ## Assist Add self.team2assadd = Button(self, width=5) self.team2assadd["text"] = "+A" self.team2assadd["command"] = self.team2assistUp self.team2assadd.grid(row=3, column=5) ## Assist Minus self.team2assmin = Button(self, width=5) self.team2assmin["text"] = "-A" self.team2assmin["command"] = self.team2assistDown self.team2assmin.grid(row=3, column=6) ## Saves Add self.team2saveadd = Button(self, width=5) self.team2saveadd["text"] = "+S" self.team2saveadd["command"] = self.team2ShotsOnUp self.team2saveadd.grid(row=4, column=5, sticky=N) ## Saves Minus self.team2savemin = Button(self, width=5) self.team2savemin["text"] = "-S" self.team2savemin["command"] = self.team2ShotsOnDown self.team2savemin.grid(row=4, column=6, sticky=N) ## Miss Add self.team2missadd = Button(self, width=5) self.team2missadd["text"] = "+M" self.team2missadd["command"] = self.team2missesUp self.team2missadd.grid(row=5, column=5, sticky=N) ## Miss Minus self.team2missmin = Button(self, width=5) self.team2missmin["text"] = "-M" self.team2missmin["command"] = self.team2missesDown self.team2missmin.grid(row=5, column=6, sticky=N) ## Create player list self.team2list = Listbox(self) for i in (player.getFullName() for player in self.team2.players): self.team2list.insert(END, i) self.team2list.grid(row=2, column=4, rowspan=3, sticky=W + E + N + S) ## MISC group = Frame(self) group.grid(row=6, column=0, columnspan=7) sep = Frame(group, height=2, width=500, borderwidth=1, relief=SUNKEN) sep.grid(row=0, columnspan=3) self.score1 = Label(group) self.score1["text"] = str(self.team1score) self.score1.grid(row=1, column=0) score = Label(group) score["text"] = "v" score.grid(row=1, column=1) self.score2 = Label(group) self.score2["text"] = str(self.team2score) self.score2.grid(row=1, column=2)
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("600x431+400+169") top.title("MQTT一体机 V1.1 互联") top.configure(background="#59d854") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.menubar = tk.Menu(top, font="TkMenuFont", bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar) self.sub_menu = tk.Menu(top, tearoff=0) self.menubar.add_cascade(menu=self.sub_menu, activebackground="#ececec", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="设置") self.sub_menu1 = tk.Menu(top, tearoff=0) self.sub_menu.add_cascade(menu=self.sub_menu1, activebackground="#ececec", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="语言设置") self.sub_menu1.add_command(activebackground="#ececec", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="中文") self.sub_menu1.add_command(activebackground="#ececec", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="English") self.sub_menu.add_command(activebackground="#ececec", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="启动设置") self.sub_menu12 = tk.Menu(top, tearoff=0) self.menubar.add_cascade(menu=self.sub_menu12, activebackground="#ececec", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="关于") self.sub_menu12.add_command(activebackground="#ececec", activeforeground="#000000", background="#63d8b9", command=mqgui_support.btn_softinfo, font="TkMenuFont", foreground="#ffffff", label="软件信息") self.sub_menu12.add_command(activebackground="#ececec", activeforeground="#000000", background="#6ed8b5", command=mqgui_support.btn_exit, compound="left", font="TkMenuFont", foreground="#ffffff", label="退出") self.style.configure('TNotebook.Tab', background=_bgcolor) self.style.configure('TNotebook.Tab', foreground=_fgcolor) self.style.map('TNotebook.Tab', background=[('selected', _compcolor), ('active', _ana2color)]) self.TNotebook1 = ttk.Notebook(top) self.TNotebook1.place(relx=0.017, rely=0.093, relheight=0.9, relwidth=0.957) self.TNotebook1.configure(width=574) self.TNotebook1.configure(takefocus="") self.TNotebook1_t0 = tk.Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t0, padding=3) self.TNotebook1.tab( 0, text="监控中心", compound="left", underline="-1", ) self.TNotebook1_t0.configure(background="#d8d111") self.TNotebook1_t0.configure(highlightbackground="#d9d9d9") self.TNotebook1_t0.configure(highlightcolor="black") self.TNotebook1_t1 = tk.Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t1, padding=3) self.TNotebook1.tab( 1, text="消息中心", compound="none", underline="-1", ) self.TNotebook1_t1.configure(background="#88d8cd") self.TNotebook1_t1.configure(highlightbackground="#d9d9d9") self.TNotebook1_t1.configure(highlightcolor="black") self.TNotebook1_t2 = tk.Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t2, padding=3) self.TNotebook1.tab( 2, text="连接设置", compound="left", underline="-1", ) self.TNotebook1_t2.configure(background="#4389d8") self.TNotebook1_t2.configure(highlightbackground="#d9d9d9") self.TNotebook1_t2.configure(highlightcolor="black") self.TNotebook1_t3 = tk.Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t3, padding=3) self.Labelframe1 = tk.LabelFrame(self.TNotebook1_t0) self.Labelframe1.place(relx=0.0, rely=0.028, relheight=0.958, relwidth=0.456) self.Labelframe1.configure(relief='groove') self.Labelframe1.configure(foreground="black") self.Labelframe1.configure(text='''发布区''') self.Labelframe1.configure(background="#00BFFF") self.Labelframe1.configure(highlightbackground="#d9d9d9") self.Labelframe1.configure(highlightcolor="black") self.Labelframe1.configure(width=260) self.TCombobox_sentopic = ttk.Combobox(self.Labelframe1) self.TCombobox_sentopic.place(relx=0.308, rely=0.058, relheight=0.067, relwidth=0.627, bordermode='ignore') self.value_list = [ "用户", "李燕", "/data/", "/data/alarm", "/data/message", "/data/notify", ] self.TCombobox_sentopic.configure(values=self.value_list) self.TCombobox_sentopic.configure( textvariable=mqgui_support.combobox_sendtopic) self.TCombobox_sentopic.configure(takefocus="") self.TCombobox_senqos = ttk.Combobox(self.Labelframe1) self.TCombobox_senqos.place(relx=0.308, rely=0.174, relheight=0.067, relwidth=0.627, bordermode='ignore') self.value_list = [ 0, 1, 2, ] self.TCombobox_senqos.configure(values=self.value_list) self.TCombobox_senqos.configure( textvariable=mqgui_support.combobox_sendqos) self.TCombobox_senqos.configure(takefocus="") self.TLabel12 = ttk.Label(self.Labelframe1) self.TLabel12.place(relx=0.038, rely=0.058, height=21, width=52, bordermode='ignore') self.TLabel12.configure(background="#9370DB") self.TLabel12.configure(foreground="#ffffff") self.TLabel12.configure(font="TkDefaultFont") self.TLabel12.configure(relief="flat") self.TLabel12.configure(text='''发布主题''') self.TLabel13 = ttk.Label(self.Labelframe1) self.TLabel13.place(relx=0.038, rely=0.174, height=21, width=52, bordermode='ignore') self.TLabel13.configure(background="#9370DB") self.TLabel13.configure(foreground="#ffffff") self.TLabel13.configure(font="TkDefaultFont") self.TLabel13.configure(relief="flat") self.TLabel13.configure(text='''发布质量''') self.style.map('TCheckbutton', background=[('selected', _bgcolor), ('active', _ana2color)]) self.TCheckbutton3 = ttk.Checkbutton(self.Labelframe1) self.TCheckbutton3.place(relx=0.038, rely=0.261, relwidth=0.404, relheight=0.0, height=30, bordermode='ignore') self.TCheckbutton3.configure(variable=mqgui_support.tch97) self.TCheckbutton3.configure(takefocus="") self.TCheckbutton3.configure(text='''保留上次发布''') self.TLabel14 = ttk.Label(self.Labelframe1) self.TLabel14.place(relx=0.038, rely=0.377, height=21, width=52, bordermode='ignore') self.TLabel14.configure(background="#9370DB") self.TLabel14.configure(foreground="#ffffff") self.TLabel14.configure(font="TkDefaultFont") self.TLabel14.configure(relief="flat") self.TLabel14.configure(text='''发布类型''') self.TCombobox_sendtype = ttk.Combobox(self.Labelframe1) self.TCombobox_sendtype.place(relx=0.308, rely=0.377, relheight=0.075, relwidth=0.615, bordermode='ignore') self.value_list = [ "string", "json", "file", ] self.TCombobox_sendtype.configure(values=self.value_list) self.TCombobox_sendtype.configure( textvariable=mqgui_support.combobox_sendtype) self.TCombobox_sendtype.configure(takefocus="") self.TSeparator2 = ttk.Separator(self.Labelframe1) self.TSeparator2.place(relx=0.038, rely=0.449, relwidth=0.885, bordermode='ignore') self.Text_sendmsg = tk.Text(self.Labelframe1) self.Text_sendmsg.place(relx=0.038, rely=0.551, relheight=0.325, relwidth=0.9, bordermode='ignore') self.Text_sendmsg.configure(background="white") self.Text_sendmsg.configure(font="TkTextFont") self.Text_sendmsg.configure(foreground="black") self.Text_sendmsg.configure(highlightbackground="#d9d9d9") self.Text_sendmsg.configure(highlightcolor="black") self.Text_sendmsg.configure(insertbackground="black") self.Text_sendmsg.configure(selectbackground="#c4c4c4") self.Text_sendmsg.configure(selectforeground="black") self.Text_sendmsg.configure(width=234) self.Text_sendmsg.configure(wrap="word") self.TLabel15 = ttk.Label(self.Labelframe1) self.TLabel15.place(relx=0.038, rely=0.493, height=21, width=52, bordermode='ignore') self.TLabel15.configure(background="#9370DB") self.TLabel15.configure(foreground="#ffffff") self.TLabel15.configure(font="TkDefaultFont") self.TLabel15.configure(relief="flat") self.TLabel15.configure(text='''发布内容''') self.Button_backsend = tk.Button(self.Labelframe1) self.Button_backsend.place(relx=0.038, rely=0.899, height=28, width=40, bordermode='ignore') self.Button_backsend.configure(activebackground="#ececec") self.Button_backsend.configure(activeforeground="#000000") self.Button_backsend.configure(background="#BDB76B") self.Button_backsend.configure(command=mqgui_support.btn_sendback) self.Button_backsend.configure(disabledforeground="#a3a3a3") self.Button_backsend.configure(foreground="#ffffff") self.Button_backsend.configure(highlightbackground="#d9d9d9") self.Button_backsend.configure(highlightcolor="black") self.Button_backsend.configure(pady="0") self.Button_backsend.configure(text='''←''') self.Button_clearsend = tk.Button(self.Labelframe1) self.Button_clearsend.place(relx=0.385, rely=0.899, height=28, width=40, bordermode='ignore') self.Button_clearsend.configure(activebackground="#ececec") self.Button_clearsend.configure(activeforeground="#000000") self.Button_clearsend.configure(background="#BDB76B") self.Button_clearsend.configure(command=mqgui_support.btn_sendclear) self.Button_clearsend.configure(disabledforeground="#a3a3a3") self.Button_clearsend.configure(foreground="#ffffff") self.Button_clearsend.configure(highlightbackground="#d9d9d9") self.Button_clearsend.configure(highlightcolor="black") self.Button_clearsend.configure(pady="0") self.Button_clearsend.configure(text='''X''') self.Button_publish = tk.Button(self.Labelframe1) self.Button_publish.place(relx=0.692, rely=0.899, height=28, width=60, bordermode='ignore') self.Button_publish.configure(activebackground="#ececec") self.Button_publish.configure(activeforeground="#000000") self.Button_publish.configure(background="#78C300") self.Button_publish.configure(command=mqgui_support.btn_send) self.Button_publish.configure(disabledforeground="#a3a3a3") self.Button_publish.configure(foreground="#ffffff") self.Button_publish.configure(highlightbackground="#d9d9d9") self.Button_publish.configure(highlightcolor="black") self.Button_publish.configure(pady="0") self.Button_publish.configure(text='''发布''') self.Button_selectfile = tk.Button(self.Labelframe1) self.Button_selectfile.place(relx=0.769, rely=0.261, height=28, width=40, bordermode='ignore') self.Button_selectfile.configure(activebackground="#ececec") self.Button_selectfile.configure(activeforeground="#000000") self.Button_selectfile.configure(background="#78C300") self.Button_selectfile.configure(command=mqgui_support.btn_selectfile) self.Button_selectfile.configure(disabledforeground="#a3a3a3") self.Button_selectfile.configure(foreground="#ffffff") self.Button_selectfile.configure(highlightbackground="#d9d9d9") self.Button_selectfile.configure(highlightcolor="black") self.Button_selectfile.configure(pady="0") self.Button_selectfile.configure(text='''. . .''') self.Labelframe2 = tk.LabelFrame(self.TNotebook1_t0) self.Labelframe2.place(relx=0.509, rely=0.028, relheight=0.958, relwidth=0.439) self.Labelframe2.configure(relief='groove') self.Labelframe2.configure(foreground="black") self.Labelframe2.configure(text='''订阅区''') self.Labelframe2.configure(background="#78C300") self.Labelframe2.configure(highlightbackground="#d9d9d9") self.Labelframe2.configure(highlightcolor="black") self.Labelframe2.configure(width=250) self.style.configure('Treeview.Heading', font="TkDefaultFont") self.Scrolledtreeview1 = ScrolledTreeView(self.Labelframe2) self.Scrolledtreeview1.place(relx=0.04, rely=0.116, relheight=0.29, relwidth=0.928, bordermode='ignore') self.Scrolledtreeview1.configure(columns="Col1 Col2") # build_treeview_support starting. self.Scrolledtreeview1.heading("#0", text="序号") self.Scrolledtreeview1.heading("#0", anchor="center") self.Scrolledtreeview1.column("#0", width="53") self.Scrolledtreeview1.column("#0", minwidth="20") self.Scrolledtreeview1.column("#0", stretch="1") self.Scrolledtreeview1.column("#0", anchor="w") self.Scrolledtreeview1.heading("Col1", text="主题") self.Scrolledtreeview1.heading("Col1", anchor="center") self.Scrolledtreeview1.column("Col1", width="110") self.Scrolledtreeview1.column("Col1", minwidth="20") self.Scrolledtreeview1.column("Col1", stretch="1") self.Scrolledtreeview1.column("Col1", anchor="center") self.Scrolledtreeview1.heading("Col2", text="质量") self.Scrolledtreeview1.heading("Col2", anchor="center") self.Scrolledtreeview1.column("Col2", width="50") self.Scrolledtreeview1.column("Col2", minwidth="20") self.Scrolledtreeview1.column("Col2", stretch="1") self.Scrolledtreeview1.column("Col2", anchor="center") self.TLabel9 = ttk.Label(self.Labelframe2) self.TLabel9.place(relx=0.32, rely=0.029, height=21, width=64, bordermode='ignore') self.TLabel9.configure(background="#00BFFF") self.TLabel9.configure(foreground="#ffffff") self.TLabel9.configure(font="TkDefaultFont") self.TLabel9.configure(relief="flat") self.TLabel9.configure(text='''已订阅内容''') self.TCombobox_subtopic = ttk.Combobox(self.Labelframe2) self.TCombobox_subtopic.place(relx=0.12, rely=0.638, relheight=0.067, relwidth=0.652, bordermode='ignore') self.value_list = [ "用户", "李燕", "/data/", "/data/alarm", "/data/message", "/data/notify", ] self.TCombobox_subtopic.configure(values=self.value_list) self.TCombobox_subtopic.configure( textvariable=mqgui_support.combobox_subtopic) self.TCombobox_subtopic.configure(takefocus="") self.TCombobox_subqos = ttk.Combobox(self.Labelframe2) self.TCombobox_subqos.place(relx=0.12, rely=0.812, relheight=0.067, relwidth=0.652, bordermode='ignore') self.value_list = [ 0, 1, 2, ] self.TCombobox_subqos.configure(values=self.value_list) self.TCombobox_subqos.configure( textvariable=mqgui_support.combobox_subqos) self.TCombobox_subqos.configure(takefocus="") self.TLabel10 = ttk.Label(self.Labelframe2) self.TLabel10.place(relx=0.28, rely=0.551, height=21, width=52, bordermode='ignore') self.TLabel10.configure(background="#9370DB") self.TLabel10.configure(foreground="#ffffff") self.TLabel10.configure(font="TkDefaultFont") self.TLabel10.configure(relief="flat") self.TLabel10.configure(text='''订阅主题''') self.TLabel11 = ttk.Label(self.Labelframe2) self.TLabel11.place(relx=0.28, rely=0.725, height=21, width=52, bordermode='ignore') self.TLabel11.configure(background="#9370DB") self.TLabel11.configure(foreground="#ffffff") self.TLabel11.configure(font="TkDefaultFont") self.TLabel11.configure(relief="flat") self.TLabel11.configure(text='''订阅质量''') self.TSeparator1 = ttk.Separator(self.Labelframe2) self.TSeparator1.place(relx=0.0, rely=0.507, relwidth=0.96, bordermode='ignore') self.Button_cancelsub = tk.Button(self.Labelframe2) self.Button_cancelsub.place(relx=0.04, rely=0.406, height=28, width=83, bordermode='ignore') self.Button_cancelsub.configure(activebackground="#ececec") self.Button_cancelsub.configure(activeforeground="#000000") self.Button_cancelsub.configure(background="#00BFFF") self.Button_cancelsub.configure(command=mqgui_support.btn_cancelsub) self.Button_cancelsub.configure(disabledforeground="#a3a3a3") self.Button_cancelsub.configure(foreground="#ffffff") self.Button_cancelsub.configure(highlightbackground="#d9d9d9") self.Button_cancelsub.configure(highlightcolor="black") self.Button_cancelsub.configure(pady="0") self.Button_cancelsub.configure(text='''取消所选订阅''') self.Button_clearsub = tk.Button(self.Labelframe2) self.Button_clearsub.place(relx=0.64, rely=0.406, height=28, width=83, bordermode='ignore') self.Button_clearsub.configure(activebackground="#ececec") self.Button_clearsub.configure(activeforeground="#000000") self.Button_clearsub.configure(background="#00BFFF") self.Button_clearsub.configure(command=mqgui_support.btn_clearsub) self.Button_clearsub.configure(disabledforeground="#a3a3a3") self.Button_clearsub.configure(foreground="#ffffff") self.Button_clearsub.configure(highlightbackground="#d9d9d9") self.Button_clearsub.configure(highlightcolor="black") self.Button_clearsub.configure(pady="0") self.Button_clearsub.configure(text='''清空订阅列表''') self.Button_addsub = tk.Button(self.Labelframe2) self.Button_addsub.place(relx=0.28, rely=0.899, height=28, width=59, bordermode='ignore') self.Button_addsub.configure(activebackground="#ececec") self.Button_addsub.configure(activeforeground="#000000") self.Button_addsub.configure(background="#00BFFF") self.Button_addsub.configure(command=mqgui_support.btn_addsub) self.Button_addsub.configure(disabledforeground="#a3a3a3") self.Button_addsub.configure(foreground="#ffffff") self.Button_addsub.configure(highlightbackground="#d9d9d9") self.Button_addsub.configure(highlightcolor="black") self.Button_addsub.configure(pady="0") self.Button_addsub.configure(text='''添加订阅''') self.Frame1 = tk.Frame(self.TNotebook1_t1) self.Frame1.place(relx=0.018, rely=0.028, relheight=0.931, relwidth=0.939) self.Frame1.configure(relief='groove') self.Frame1.configure(borderwidth="2") self.Frame1.configure(relief="groove") self.Frame1.configure(background="#d8ac72") self.Frame1.configure(highlightbackground="#d9d9d9") self.Frame1.configure(highlightcolor="black") self.Frame1.configure(width=535) self.Scrolledtext1 = ScrolledText(self.Frame1) self.Scrolledtext1.place(relx=0.019, rely=0.03, relheight=0.851, relwidth=0.955) self.Scrolledtext1.configure(background="white") self.Scrolledtext1.configure(font="TkTextFont") self.Scrolledtext1.configure(foreground="black") self.Scrolledtext1.configure(highlightbackground="#d9d9d9") self.Scrolledtext1.configure(highlightcolor="black") self.Scrolledtext1.configure(insertbackground="black") self.Scrolledtext1.configure(insertborderwidth="3") self.Scrolledtext1.configure(selectbackground="#c4c4c4") self.Scrolledtext1.configure(selectforeground="black") self.Scrolledtext1.configure(width=10) self.Scrolledtext1.configure(wrap="none") self.Button_savemsg = tk.Button(self.Frame1) self.Button_savemsg.place(relx=0.449, rely=0.896, height=28, width=59) self.Button_savemsg.configure(activebackground="#ececec") self.Button_savemsg.configure(activeforeground="#000000") self.Button_savemsg.configure(background="#78C300") self.Button_savemsg.configure(command=mqgui_support.btn_savemsg) self.Button_savemsg.configure(disabledforeground="#a3a3a3") self.Button_savemsg.configure(foreground="#ffffff") self.Button_savemsg.configure(highlightbackground="#d9d9d9") self.Button_savemsg.configure(highlightcolor="black") self.Button_savemsg.configure(pady="0") self.Button_savemsg.configure(text='''消息入库''') self.Button_readhistory = tk.Button(self.Frame1) self.Button_readhistory.place(relx=0.617, rely=0.896, height=28, width=83) self.Button_readhistory.configure(activebackground="#ececec") self.Button_readhistory.configure(activeforeground="#000000") self.Button_readhistory.configure(background="#78C300") self.Button_readhistory.configure( command=mqgui_support.btn_readhistory) self.Button_readhistory.configure(disabledforeground="#a3a3a3") self.Button_readhistory.configure(foreground="#ffffff") self.Button_readhistory.configure(highlightbackground="#d9d9d9") self.Button_readhistory.configure(highlightcolor="black") self.Button_readhistory.configure(pady="0") self.Button_readhistory.configure(text='''查看历史消息''') self.Button_clearmsg = tk.Button(self.Frame1) self.Button_clearmsg.place(relx=0.841, rely=0.896, height=28, width=59) self.Button_clearmsg.configure(activebackground="#ececec") self.Button_clearmsg.configure(activeforeground="#000000") self.Button_clearmsg.configure(background="#78C300") self.Button_clearmsg.configure(command=mqgui_support.btn_clearmsg) self.Button_clearmsg.configure(disabledforeground="#a3a3a3") self.Button_clearmsg.configure(foreground="#ffffff") self.Button_clearmsg.configure(highlightbackground="#d9d9d9") self.Button_clearmsg.configure(highlightcolor="black") self.Button_clearmsg.configure(pady="0") self.Button_clearmsg.configure(text='''清空消息''') self.TCheckbutton_automsgsave = ttk.Checkbutton(self.Frame1) self.TCheckbutton_automsgsave.place(relx=0.019, rely=0.896, relwidth=0.187, relheight=0.0, height=30) self.TCheckbutton_automsgsave.configure(variable=mqgui_support.tch50) self.TCheckbutton_automsgsave.configure(takefocus="") self.TCheckbutton_automsgsave.configure(text='''消息自动入库''') self.Button_savefiles = tk.Button(self.Frame1) self.Button_savefiles.place(relx=0.262, rely=0.896, height=28, width=71) self.Button_savefiles.configure(activebackground="#ececec") self.Button_savefiles.configure(activeforeground="#000000") self.Button_savefiles.configure(background="#78C300") self.Button_savefiles.configure(command=mqgui_support.btn_savefiles) self.Button_savefiles.configure(disabledforeground="#a3a3a3") self.Button_savefiles.configure(foreground="#ffffff") self.Button_savefiles.configure(highlightbackground="#d9d9d9") self.Button_savefiles.configure(highlightcolor="black") self.Button_savefiles.configure(pady="0") self.Button_savefiles.configure(text='''保存到文件''') self.TEntry_clientname = ttk.Entry(self.TNotebook1_t2) self.TEntry_clientname.place(relx=0.035, rely=0.111, relheight=0.064, relwidth=0.256) self.TEntry_clientname.configure( textvariable=mqgui_support.entrytv_clientname) self.TEntry_clientname.configure(takefocus="") self.TEntry_clientname.configure(cursor="ibeam") self.TEntry_clientid = ttk.Entry(self.TNotebook1_t2) self.TEntry_clientid.place(relx=0.386, rely=0.111, relheight=0.064, relwidth=0.256) self.TEntry_clientid.configure( textvariable=mqgui_support.entrytv_clientid) self.TEntry_clientid.configure(takefocus="") self.TEntry_clientid.configure(cursor="ibeam") self.TLabel1 = ttk.Label(self.TNotebook1_t2) self.TLabel1.place(relx=0.07, rely=0.028, height=21, width=104) self.TLabel1.configure(background="#78C300") self.TLabel1.configure(foreground="#ffffff") self.TLabel1.configure(font="TkDefaultFont") self.TLabel1.configure(relief="flat") self.TLabel1.configure(text='''MQTT 客户端名称''') self.TLabel2 = ttk.Label(self.TNotebook1_t2) self.TLabel2.place(relx=0.439, rely=0.028, height=21, width=89) self.TLabel2.configure(background="#78C300") self.TLabel2.configure(foreground="#ffffff") self.TLabel2.configure(font="TkDefaultFont") self.TLabel2.configure(relief="flat") self.TLabel2.configure(text='''MQTT客户端ID''') self.TLabel3 = ttk.Label(self.TNotebook1_t2) self.TLabel3.place(relx=0.07, rely=0.194, height=21, width=100) self.TLabel3.configure(background="#78C300") self.TLabel3.configure(foreground="#ffffff") self.TLabel3.configure(font="TkDefaultFont") self.TLabel3.configure(relief="flat") self.TLabel3.configure(text='''MQTT服务器类型''') self.TLabel4 = ttk.Label(self.TNotebook1_t2) self.TLabel4.place(relx=0.439, rely=0.194, height=21, width=88) self.TLabel4.configure(background="#78C300") self.TLabel4.configure(foreground="#ffffff") self.TLabel4.configure(font="TkDefaultFont") self.TLabel4.configure(relief="flat") self.TLabel4.configure(text='''MQTT连接协议''') self.TLabel5 = ttk.Label(self.TNotebook1_t2) self.TLabel5.place(relx=0.07, rely=0.361, height=21, width=100) self.TLabel5.configure(background="#78C300") self.TLabel5.configure(foreground="#ffffff") self.TLabel5.configure(font="TkDefaultFont") self.TLabel5.configure(relief="flat") self.TLabel5.configure(text='''MQTT服务器地址''') self.TLabel6 = ttk.Label(self.TNotebook1_t2) self.TLabel6.place(relx=0.421, rely=0.361, height=21, width=112) self.TLabel6.configure(background="#78C300") self.TLabel6.configure(foreground="#ffffff") self.TLabel6.configure(font="TkDefaultFont") self.TLabel6.configure(relief="flat") self.TLabel6.configure(text='''MQTT服务器端口号''') self.TLabel7 = ttk.Label(self.TNotebook1_t2) self.TLabel7.place(relx=0.105, rely=0.528, height=21, width=64) self.TLabel7.configure(background="#78C300") self.TLabel7.configure(foreground="#ffffff") self.TLabel7.configure(font="TkDefaultFont") self.TLabel7.configure(relief="flat") self.TLabel7.configure(text='''设备用户名''') self.TLabel8 = ttk.Label(self.TNotebook1_t2) self.TLabel8.place(relx=0.474, rely=0.528, height=21, width=52) self.TLabel8.configure(background="#78C300") self.TLabel8.configure(foreground="#ffffff") self.TLabel8.configure(font="TkDefaultFont") self.TLabel8.configure(relief="flat") self.TLabel8.configure(text='''设备密码''') self.TCheckbutton_autoconnect = ttk.Checkbutton(self.TNotebook1_t2) self.TCheckbutton_autoconnect.place(relx=0.035, rely=0.806, relwidth=0.14, relheight=0.0, height=30) self.TCheckbutton_autoconnect.configure(variable=mqgui_support.tch68) self.TCheckbutton_autoconnect.configure(takefocus="") self.TCheckbutton_autoconnect.configure(text='''自动连接''') self.TCombobox_mqtype = ttk.Combobox(self.TNotebook1_t2) self.TCombobox_mqtype.place(relx=0.035, rely=0.278, relheight=0.064, relwidth=0.286) self.value_list = [ "EMQ", "Apollo", ] self.TCombobox_mqtype.configure(values=self.value_list) self.TCombobox_mqtype.configure( textvariable=mqgui_support.combobox_servertype) self.TCombobox_mqtype.configure(takefocus="") self.TCombobox_mqsl = ttk.Combobox(self.TNotebook1_t2) self.TCombobox_mqsl.place(relx=0.386, rely=0.278, relheight=0.064, relwidth=0.286) self.value_list = [ "tcp", "ws", "ssl", ] self.TCombobox_mqsl.configure(values=self.value_list) self.TCombobox_mqsl.configure(textvariable=mqgui_support.combobox_mqsl) self.TCombobox_mqsl.configure(takefocus="") self.TCombobox_mqport = ttk.Combobox(self.TNotebook1_t2) self.TCombobox_mqport.place(relx=0.386, rely=0.444, relheight=0.064, relwidth=0.286) self.value_list = [ 1883, 8083, 8883, 61613, 61623, ] self.TCombobox_mqport.configure(values=self.value_list) self.TCombobox_mqport.configure( textvariable=mqgui_support.combobox_mqport) self.TCombobox_mqport.configure(takefocus="") self.TCombobox_mqip = ttk.Combobox(self.TNotebook1_t2) self.TCombobox_mqip.place(relx=0.035, rely=0.444, relheight=0.064, relwidth=0.286) self.value_list = [ "127.0.0.1", "47.93.30.53", ] self.TCombobox_mqip.configure(values=self.value_list) self.TCombobox_mqip.configure(textvariable=mqgui_support.combobox_mqip) self.TCombobox_mqip.configure(takefocus="") self.TCombobox_username = ttk.Combobox(self.TNotebook1_t2) self.TCombobox_username.place(relx=0.035, rely=0.611, relheight=0.064, relwidth=0.286) self.value_list = [ "admin", "liyan", ] self.TCombobox_username.configure(values=self.value_list) self.TCombobox_username.configure( textvariable=mqgui_support.combobox_username) self.TCombobox_username.configure(takefocus="") self.TCombobox_pwd = ttk.Combobox(self.TNotebook1_t2) self.TCombobox_pwd.place(relx=0.386, rely=0.611, relheight=0.064, relwidth=0.286) self.value_list = [ "public", "admin", "123456", ] self.TCombobox_pwd.configure(values=self.value_list) self.TCombobox_pwd.configure(show="*") self.TCombobox_pwd.configure(textvariable=mqgui_support.combobox_pwd) self.TCombobox_pwd.configure(takefocus="") self.TCheckbutton_automoren = ttk.Checkbutton(self.TNotebook1_t2) self.TCheckbutton_automoren.place(relx=0.684, rely=0.444, relwidth=0.132, relheight=0.0, height=30) self.TCheckbutton_automoren.configure(variable=mqgui_support.tch76) self.TCheckbutton_automoren.configure(takefocus="") self.TCheckbutton_automoren.configure(text='''自动默认''') self.Button_showhide = tk.Button(self.TNotebook1_t2) self.Button_showhide.place(relx=0.684, rely=0.611, height=28, width=50) self.Button_showhide.configure(activebackground="#ececec") self.Button_showhide.configure(activeforeground="#000000") self.Button_showhide.configure(background="#00BFFF") self.Button_showhide.configure(command=mqgui_support.btn_showhide) self.Button_showhide.configure(disabledforeground="#a3a3a3") self.Button_showhide.configure(foreground="#ffffff") self.Button_showhide.configure(highlightbackground="#d9d9d9") self.Button_showhide.configure(highlightcolor="black") self.Button_showhide.configure(pady="0") self.Button_showhide.configure(text='''显示''') self.Button_randomgener = tk.Button(self.TNotebook1_t2) self.Button_randomgener.place(relx=0.649, rely=0.111, height=28, width=59) self.Button_randomgener.configure(activebackground="#ececec") self.Button_randomgener.configure(activeforeground="#000000") self.Button_randomgener.configure(background="#00BFFF") self.Button_randomgener.configure( command=mqgui_support.btn_randomgerner) self.Button_randomgener.configure(disabledforeground="#a3a3a3") self.Button_randomgener.configure(foreground="#ffffff") self.Button_randomgener.configure(highlightbackground="#d9d9d9") self.Button_randomgener.configure(highlightcolor="black") self.Button_randomgener.configure(pady="0") self.Button_randomgener.configure(text='''随机生成''') self.Button_savesettings = tk.Button(self.TNotebook1_t2) self.Button_savesettings.place(relx=0.246, rely=0.806, height=28, width=59) self.Button_savesettings.configure(activebackground="#ececec") self.Button_savesettings.configure(activeforeground="#000000") self.Button_savesettings.configure(background="#00BFFF") self.Button_savesettings.configure( command=mqgui_support.btn_savesettings) self.Button_savesettings.configure(disabledforeground="#a3a3a3") self.Button_savesettings.configure(foreground="#ffffff") self.Button_savesettings.configure(highlightbackground="#d9d9d9") self.Button_savesettings.configure(highlightcolor="black") self.Button_savesettings.configure(pady="0") self.Button_savesettings.configure(text='''保存设置''') self.Button_connect = tk.Button(top) self.Button_connect.place(relx=0.017, rely=0.023, height=28, width=100) self.Button_connect.configure(activebackground="#ececec") self.Button_connect.configure(activeforeground="#000000") self.Button_connect.configure(background="#00BFFF") self.Button_connect.configure(command=mqgui_support.btn_connect) self.Button_connect.configure(disabledforeground="#a3a3a3") self.Button_connect.configure(foreground="#ffffff") self.Button_connect.configure(highlightbackground="#d9d9d9") self.Button_connect.configure(highlightcolor="black") self.Button_connect.configure(pady="0") self.Button_connect.configure(text='''开始连接''') self.TProgressbar1 = ttk.Progressbar(top) self.TProgressbar1.place(relx=0.633, rely=0.023, relwidth=0.25, relheight=0.0, height=22) self.TProgressbar1.configure(variable=mqgui_support.tpb_send) self.TProgressbar1.configure(value="0.5") self.TLabel_jindu = ttk.Label(top) self.TLabel_jindu.place(relx=0.9, rely=0.023, height=21, width=40) self.TLabel_jindu.configure(background="#00BFFF") self.TLabel_jindu.configure(foreground="#ffffff") self.TLabel_jindu.configure(font="TkDefaultFont") self.TLabel_jindu.configure(relief="flat") self.TLabel_jindu.configure(textvariable=mqgui_support.labletv_jindu) self.TEntry_filepath = ttk.Entry(top) self.TEntry_filepath.place(relx=0.25, rely=0.023, relheight=0.053, relwidth=0.36) self.TEntry_filepath.configure( textvariable=mqgui_support.entrytv_filepath) self.TEntry_filepath.configure(takefocus="") self.TEntry_filepath.configure(cursor="ibeam")
def build_gui(self, parent): self._window = Tkinter.Toplevel(parent) self._window.transient(parent) self._window.title("Preferences") self._frame = ttk.Frame(self._window) self._frame.pack(padx=15, pady=15) ttk.Label(self._frame, text="Detection Rate (ms): ").grid(column=0, row=0) self._detection_rate_spinbox = Tkinter.Spinbox(self._frame, from_=1, to=60000) self._detection_rate_spinbox.delete(0, Tkinter.END) self._detection_rate_spinbox.insert( 0, self._preferences[configurator.DETECTION_RATE]) rate_validator = (self._window.register(self.check_detection_rate), '%P') self._detection_rate_spinbox.config(validate="key", validatecommand=rate_validator) self._detection_rate_spinbox.grid(column=1, row=0) ttk.Label(self._frame, text="Laser Intensity: ").grid(column=0, row=1) self._laser_intensity_spinbox = Tkinter.Spinbox(self._frame, from_=0, to=255) self._laser_intensity_spinbox.delete(0, Tkinter.END) self._laser_intensity_spinbox.insert( 0, self._preferences[configurator.LASER_INTENSITY]) intensity_validator = (self._window.register( self.check_laser_intensity), '%P') self._laser_intensity_spinbox.config( validate="key", validatecommand=intensity_validator) self._laser_intensity_spinbox.grid(column=1, row=1) ttk.Label(self._frame, text="Marker Radius: ").grid(column=0, row=2) self._marker_radius_spinbox = Tkinter.Spinbox(self._frame, from_=1, to=20) self._marker_radius_spinbox.delete(0, Tkinter.END) self._marker_radius_spinbox.insert( 0, self._preferences[configurator.MARKER_RADIUS]) radius_validator = (self._window.register(self.check_marker_radius), '%P') self._marker_radius_spinbox.config(validate="key", validatecommand=radius_validator) self._marker_radius_spinbox.grid(column=1, row=2) ttk.Label(self._frame, text="Ignore Laser Color: ").grid(column=0, row=3) self._ignore_laser_color_combo = ttk.Combobox( self._frame, values=["none", "red", "green"], state="readonly") self._ignore_laser_color_combo.set( self._preferences[configurator.IGNORE_LASER_COLOR]) self._ignore_laser_color_combo.grid(column=1, row=3) self._ok_button = ttk.Button(self._frame, text="OK", command=self.save_preferences, width=10) self._ok_button.grid(column=0, row=4) self._cancel_button = ttk.Button(self._frame, text="Cancel", command=self._window.destroy, width=10) self._cancel_button.grid(column=1, row=4) # Center this window on its parent parent_width = parent.winfo_width() parent_height = parent.winfo_height() parent_x = parent.winfo_rootx() parent_y = parent.winfo_rooty() self_width = self._window.winfo_width() self_height = self._window.winfo_height() self._window.geometry( "+%d+%d" % (parent_x + (parent_width - self_width) / 4, parent_y + (parent_height - self_height) / 4)) self._frame.pack()
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#00407f' # Closest X11 color: 'DodgerBlue4' _ana1color = '#7f7f00' # Closest X11 color: 'gold4' _ana2color = '#7f0000' # Closest X11 color: 'red4' font10 = "-family {Courier New} -size 10 -weight normal -slant" \ " roman -underline 0 -overstrike 0" font9 = "-family {Segoe UI} -size 9 -weight normal -slant " \ "roman -underline 0 -overstrike 0" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background= [('selected', _compcolor), ('active', _ana2color)]) self.style.map('.', foreground= [('selected', 'white'), ('active', 'white')]) top.geometry("699x509") top.title("Simba") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") top.resizable(False, False) #This is the display for the Menubar self.menubar = Menu(top, font=font9, bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar) self.file = Menu(top, tearoff=0) self.menubar.add_cascade(menu=self.file, activebackground="#7f0000", activeforeground="#111111", background="#d9d9d9", font=font9, foreground="#000000", label="File") self.file.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=lambda: [Simba_support.clearData(), disableOnLoad(), updateTags()], font=font9, foreground="#000000", label="Clear Data", state=DISABLED) self.file.add_separator( background="#d9d9d9") self.open_from = Menu(top, tearoff=0) self.file.add_cascade(menu=self.open_from, activebackground="#7f0000", activeforeground="#111111", background="#d9d9d9", font=font9, foreground="#000000", label="Open From") self.open_from.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=lambda: [warningGetLocal(), enableOnLoad()], font=font9, foreground="#000000", label="Local File") def warningGetLocal(): try: Simba_support.getLocalData() updateTags() except ValueError: from tkinter import messagebox messagebox.showerror("Error", "No data set was loaded, please review your directories and/or credentials") except AttributeError: pass #Will handle later except: pass def updateTags(): ''' Clears and updates the list of data tags in the listbox. Should trigger whenever a mod preforms on the set :return: ''' self.tagListBox2.delete(0, END) if (Simba_support.dataSet is None): pass elif not (('error' in Simba_support.dataSet) or ( Simba_support.dataSet == {})): for key, value in Simba_support.dataSet['series'][0]['tags'].items(): self.tagListBox2.insert(END, key + " : " + value) self.open_from.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=lambda: openHostPanel(), font=font9, foreground="#000000", label="Hosted Service") self.file.add_separator( background="#d9d9d9") self.file.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=Simba_support.saveLocalData, font=font9, foreground="#000000", label="Save As", state=DISABLED) self.file.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=lambda: openExportPanel(), font=font9, foreground="#000000", label="Export", state=DISABLED) self.modules = Menu(top, tearoff=0) self.menubar.add_cascade(menu=self.modules, activebackground="#7f0000", activeforeground="#111111", background="#d9d9d9", font=font9, foreground="#000000", label="Modules") self.modules.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=lambda: populateCombo(), font=font9, foreground="#000000", label="Import Module") self.help = Menu(top, tearoff=0) self.menubar.add_cascade(menu=self.help, activebackground="#7f0000", activeforeground="#111111", background="#d9d9d9", font=font9, foreground="#000000", label="Help") self.help.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=Simba_support.openHelp, font=font9, foreground="#000000", label="Main Docs") self.mainSimbaFrame = ttk.Frame(top) self.mainSimbaFrame.place(relx=0.0, rely=0.0, relheight=1.01, relwidth=1.01) self.mainSimbaFrame.configure(relief=GROOVE) self.mainSimbaFrame.configure(borderwidth="2") self.mainSimbaFrame.configure(relief=GROOVE) self.mainSimbaFrame.configure(width=705) self.mainSimbaFrame.configure(takefocus="0") #The listbox for variables from a selected mod operation self.varListBox = tagListBox(self.mainSimbaFrame) self.varListBox.place(relx=0.01, rely=0.08, relheight=0.81 , relwidth=0.46) self.varListBox.configure(background="white") self.varListBox.configure(disabledforeground="#a3a3a3") self.varListBox.configure(font=font10) self.varListBox.configure(foreground="black") self.varListBox.configure(highlightbackground="#d9d9d9") self.varListBox.configure(highlightcolor="#d9d9d9") self.varListBox.configure(selectbackground="#c4c4c4") self.varListBox.configure(selectforeground="black") self.varListBox.configure(takefocus="0") self.varListBox.configure(width=10) #Tag listbox that will populate with tags of current dataset self.tagListBox2 = tagListBox(self.mainSimbaFrame) self.tagListBox2.place(relx=0.5, rely=0.08, relheight=0.81 , relwidth=0.46) self.tagListBox2.configure(background="white") self.tagListBox2.configure(disabledforeground="#a3a3a3") self.tagListBox2.configure(font=font10) self.tagListBox2.configure(foreground="black") self.tagListBox2.configure(highlightbackground="#d9d9d9") self.tagListBox2.configure(highlightcolor="#d9d9d9") self.tagListBox2.configure(selectbackground="#c4c4c4") self.tagListBox2.configure(selectforeground="black") self.tagListBox2.configure(takefocus="0") self.tagListBox2.configure(width=10) # Combobox that mod operations will be loaded into self.dataOpCombo = ttk.Combobox(self.mainSimbaFrame) self.dataOpCombo.place(relx=0.5, rely=0.89, relheight=0.05 , relwidth=0.32) self.dataOpCombo.configure(textvariable=Simba_support.combobox) self.dataOpCombo.configure(takefocus="", state="readonly") def populateCombo(): ''' Function fills the combobox with the list of methodObject names in the imported mod. If no mod is selected nothing should happen :return: ''' try: Simba_support.loadMod() listCol = [x.name for x in (Simba_support.getMod())] self.dataOpCombo.configure(values=listCol) except: pass def onselect(evt): ''' Onselect handling for the custom variables that are in the var listbox These should change and populate accordingly to the function that is selected Variables should also be persistent after being changed :param evt: :return: ''' # Note here that Tkinter passes an event object to onselect() self.varListBox.delete(0, END) w = evt.widget index = int(w.current()) # Populating Varboxes on select for n in (Simba_support.getMod())[index].vars: self.varListBox.insert(END, str(n.name) +" : "+ str(n.value)) # value = w.get(index) self.dataOpCombo.bind('<<ComboboxSelected>>', onselect) self.varListBox.configure(exportselection=False) def editVar(): # List of MethodObjects func = Simba_support.getMod() (func[self.dataOpCombo.current()].vars[ self.varListBox.curselection()[0]].value) = Simba_support.editVarVar.get() self.varListBox.delete(0, END) for n in func[self.dataOpCombo.current()].vars: self.varListBox.insert(END, str(n.name) + " : " + str(n.value)) self.setVarButton = ttk.Button(self.mainSimbaFrame) self.setVarButton.place(relx=0.355, rely=0.89, height=30, width=78) self.setVarButton.configure(takefocus="") self.setVarButton.configure(text='''Set''') self.setVarButton.configure(command=lambda: editVar()) self.setVarEnt = ttk.Entry(self.mainSimbaFrame) self.setVarEnt.place(relx=0.01, rely=0.89, relheight=0.05, relwidth=0.32) self.setVarEnt.configure(textvariable=Simba_support.editVarVar) self.setVarEnt.configure(takefocus="") self.setVarEnt.configure(cursor="ibeam") #Apply button that should do selected operations and update any tags applied to the data set self.dataOpButton = ttk.Button(self.mainSimbaFrame) self.dataOpButton.place(relx=0.84, rely=0.89, height=30, width=78) self.dataOpButton.configure(takefocus="") self.dataOpButton.configure(text='''Apply''') self.dataOpButton.configure(command= lambda: [ Simba_support.doSelectedOps(self.dataOpCombo.current()), updateTags()]) self.varListLab = ttk.Label(self.mainSimbaFrame) self.varListLab.place(relx=0.17, rely=0.02, height=24, width=85) self.varListLab.configure(background="#d9d9d9") self.varListLab.configure(foreground="#000000") self.varListLab.configure(relief=FLAT) self.varListLab.configure(takefocus="0") self.varListLab.configure(text='''Variable List''') self.tagsListLab = ttk.Label(self.mainSimbaFrame) self.tagsListLab.place(relx=0.67, rely=0.02, height=24, width=71) self.tagsListLab.configure(background="#d9d9d9") self.tagsListLab.configure(foreground="#000000") self.tagsListLab.configure(relief=FLAT) self.tagsListLab.configure(takefocus="0") self.tagsListLab.configure(text='''Data Tags''') #Loadbar to show when a dataset is correctly loaded self.loadBar = ttk.Progressbar(self.mainSimbaFrame) self.loadBar.place(relx=0.01, rely=0.02, relwidth=0.07, relheight=0.0 , height=22) self.loadBar.configure(variable=Simba_support.loadBarVar) self.loadBar.configure(takefocus="0") # Class for HostedService Frame class Hosted_Service: def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#00407f' # Closest X11 color: 'DodgerBlue4' _ana1color = '#7f7f00' # Closest X11 color: 'gold4' _ana2color = '#7f0000' # Closest X11 color: 'red4' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background= [('selected', _compcolor), ('active', _ana2color)]) self.style.map('.', foreground= [('selected', 'white'), ('active', 'white')]) top.geometry("641x480") top.title("Hosted Service") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.selectLabFrame = ttk.Labelframe(top) self.selectLabFrame.place(relx=0.02, rely=0.0, relheight=0.47 , relwidth=0.33) self.selectLabFrame.configure(text='''Input Project Selector''') self.selectLabFrame.configure(width=210) self.projectInputEnt = ttk.Entry(self.selectLabFrame) self.projectInputEnt.place(relx=0.05, rely=0.27, relheight=0.12 , relwidth=0.79) self.projectInputEnt.configure(textvariable=Simba_support.projectInputVar) self.projectInputEnt.configure(takefocus="") self.projectInputEnt.configure(cursor="ibeam") self.seriesInputEnt = ttk.Entry(self.selectLabFrame) self.seriesInputEnt.place(relx=0.05, rely=0.62, relheight=0.12 , relwidth=0.79) self.seriesInputEnt.configure(textvariable=Simba_support.seriesInputVar) self.seriesInputEnt.configure(takefocus="") self.seriesInputEnt.configure(cursor="ibeam") self.seriesInputLab = ttk.Label(self.selectLabFrame) self.seriesInputLab.place(relx=0.05, rely=0.44, height=24, width=43) self.seriesInputLab.configure(background="#d9d9d9") self.seriesInputLab.configure(foreground="#000000") self.seriesInputLab.configure(relief=FLAT) self.seriesInputLab.configure(text='''Series''') self.projectInputLab = ttk.Label(self.selectLabFrame) self.projectInputLab.place(relx=0.05, rely=0.13, height=24, width=50) self.projectInputLab.configure(background="#d9d9d9") self.projectInputLab.configure(foreground="#000000") self.projectInputLab.configure(relief=FLAT) self.projectInputLab.configure(text='''Project''') self.buildURLButton = ttk.Button(self.selectLabFrame) self.buildURLButton.place(relx=0.05, rely=0.8, height=30, width=88) self.buildURLButton.configure(command=lambda: setEnt()) self.buildURLButton.configure(takefocus="") self.buildURLButton.configure(text='''Create URL''') #Sets values due to compile time binding failing def setEnt(): Simba_support.projectInputVar.set(self.projectInputEnt.get()) Simba_support.seriesInputVar.set(self.seriesInputEnt.get()) Simba_support.urlInputVar.set(Simba_support.buildURL()) self.urlEnt.insert(END, Simba_support.buildURL()) self.timeLabFrame = ttk.Labelframe(top) self.timeLabFrame.place(relx=0.36, rely=0.0, relheight=0.47 , relwidth=0.59) self.timeLabFrame.configure(text='''Time Query''') self.timeLabFrame.configure(width=380) self.startingTimeStdEnt = ttk.Entry(self.timeLabFrame) self.startingTimeStdEnt.place(relx=0.03, rely=0.36, relheight=0.12 , relwidth=0.41) self.startingTimeStdEnt.configure(textvariable=Simba_support.stdStartVar) self.startingTimeStdEnt.configure(takefocus="") self.startingTimeStdEnt.configure(cursor="ibeam") self.startingTimeStdEnt.configure(state=DISABLED) self.startingTimeEpoEnt = ttk.Entry(self.timeLabFrame) self.startingTimeEpoEnt.place(relx=0.5, rely=0.36, relheight=0.12 , relwidth=0.41) self.startingTimeEpoEnt.configure(textvariable=Simba_support.epoStartVar) self.startingTimeEpoEnt.configure(takefocus="") self.startingTimeEpoEnt.configure(cursor="ibeam") self.startingTimeEpoEnt.configure(state=DISABLED) self.endingTimeStdEnt = ttk.Entry(self.timeLabFrame) self.endingTimeStdEnt.place(relx=0.03, rely=0.67, relheight=0.12 , relwidth=0.41) self.endingTimeStdEnt.configure(textvariable=Simba_support.stdEndVar) self.endingTimeStdEnt.configure(takefocus="") self.endingTimeStdEnt.configure(cursor="ibeam") self.endingTimeStdEnt.configure(state=DISABLED) self.endingTimeEpoEnt = ttk.Entry(self.timeLabFrame) self.endingTimeEpoEnt.place(relx=0.5, rely=0.67, relheight=0.12 , relwidth=0.41) self.endingTimeEpoEnt.configure(textvariable=Simba_support.epoEndVar) self.endingTimeEpoEnt.configure(takefocus="") self.endingTimeEpoEnt.configure(cursor="ibeam") self.endingTimeEpoEnt.configure(state=DISABLED) self.endTimeLab = ttk.Label(self.timeLabFrame) self.endTimeLab.place(relx=0.03, rely=0.53, height=24, width=87) self.endTimeLab.configure(background="#d9d9d9") self.endTimeLab.configure(foreground="#000000") self.endTimeLab.configure(relief=FLAT) self.endTimeLab.configure(text='''Ending Time''') self.stdStartLab = ttk.Label(self.timeLabFrame) self.stdStartLab.place(relx=0.03, rely=0.09, height=44, width=160) self.stdStartLab.configure(background="#d9d9d9") self.stdStartLab.configure(foreground="#000000") self.stdStartLab.configure(relief=FLAT) self.stdStartLab.configure(text="Starting Time \n(dd.mm.yyyy hh:mm:ss)") self.epochLab = ttk.Label(self.timeLabFrame) self.epochLab.place(relx=0.5, rely=0.18, height=24, width=92) self.epochLab.configure(background="#d9d9d9") self.epochLab.configure(foreground="#000000") self.epochLab.configure(relief=FLAT) self.epochLab.configure(text='''(Epoch Time)''') self.timeButton1 = ttk.Button(self.timeLabFrame) self.timeButton1.place(relx=0.08, rely=0.8, relwidth=0.32, relheight=0.0 , height=26) self.timeButton1.configure(command=lambda: activeStandard()) self.timeButton1.configure(takefocus="") self.timeButton1.configure(text='''Use Standard''') self.epochButton1 = ttk.Button(self.timeLabFrame) self.epochButton1.place(relx=0.55, rely=0.8, relwidth=0.27, relheight=0.0 , height=26) self.epochButton1.configure(command=lambda: activeEpo()) self.epochButton1.configure(takefocus="") self.epochButton1.configure(text='''Use Epoch''') def activeEpo(): self.endingTimeEpoEnt.configure(state=NORMAL) self.startingTimeEpoEnt.configure(state=NORMAL) self.startingTimeStdEnt.configure(state=DISABLED) self.endingTimeStdEnt.configure(state=DISABLED) Simba_support.epochTime() def activeStandard(): self.endingTimeEpoEnt.configure(state=DISABLED) self.startingTimeEpoEnt.configure(state=DISABLED) self.startingTimeStdEnt.configure(state=NORMAL) self.endingTimeStdEnt.configure(state=NORMAL) Simba_support.standardTime() self.accessLabFrame = ttk.Labelframe(top) self.accessLabFrame.place(relx=0.36, rely=0.48, relheight=0.3 , relwidth=0.59) self.accessLabFrame.configure(text='''Access''') self.accessLabFrame.configure(width=380) self.usernameEnt = ttk.Entry(self.accessLabFrame) self.usernameEnt.place(relx=0.03, rely=0.34, relheight=0.18 , relwidth=0.41) self.usernameEnt.configure(textvariable=Simba_support.usernameInputVar) self.usernameEnt.configure(takefocus="") self.usernameEnt.configure(cursor="ibeam") self.passwordEnt = ttk.Entry(self.accessLabFrame) self.passwordEnt.place(relx=0.5, rely=0.34, relheight=0.18 , relwidth=0.41) self.passwordEnt.configure(textvariable=Simba_support.passwordInputVar) self.passwordEnt.configure(takefocus="") self.passwordEnt.configure(cursor="ibeam") self.usernameLab = ttk.Label(self.accessLabFrame) self.usernameLab.place(relx=0.03, rely=0.14, height=24, width=70) self.usernameLab.configure(background="#d9d9d9") self.usernameLab.configure(foreground="#000000") self.usernameLab.configure(relief=FLAT) self.usernameLab.configure(text='''Username''') self.passwordLab = ttk.Label(self.accessLabFrame) self.passwordLab.place(relx=0.5, rely=0.14, height=24, width=66) self.passwordLab.configure(background="#d9d9d9") self.passwordLab.configure(foreground="#000000") self.passwordLab.configure(relief=FLAT) self.passwordLab.configure(text='''Password''') self.urlEnt = ttk.Entry(self.accessLabFrame) self.urlEnt.place(relx=0.03, rely=0.76, relheight=0.18, relwidth=0.62) self.urlEnt.configure(textvariable=Simba_support.urlInputVar) self.urlEnt.configure(takefocus="") self.urlEnt.configure(cursor="ibeam") self.urlLab = ttk.Label(self.accessLabFrame) self.urlLab.place(relx=0.03, rely=0.55, height=24, width=30) self.urlLab.configure(background="#d9d9d9") self.urlLab.configure(foreground="#000000") self.urlLab.configure(relief=FLAT) self.urlLab.configure(text='''URL''') self.getDataButton = ttk.Button(self.accessLabFrame) self.getDataButton.place(relx=0.68, rely=0.76, height=30, width=98) self.getDataButton.configure(command=lambda: [warningGetData(), enableOnLoad()]) self.getDataButton.configure(takefocus="") self.getDataButton.configure(text='''Get Data''') # Due To Broken Complile time bindings from making a new window def warningGetData(): try: Simba_support.usernameInputVar.set(self.usernameEnt.get()) Simba_support.passwordInputVar.set(self.passwordEnt.get()) Simba_support.epoStartVar.set(self.startingTimeEpoEnt.get()) Simba_support.epoEndVar.set(self.endingTimeEpoEnt.get()) Simba_support.stdStartVar.set(self.startingTimeStdEnt.get()) Simba_support.stdEndVar.set(self.endingTimeStdEnt.get()) Simba_support.urlInputVar.set(self.urlEnt.get()) Simba_support.getData() updateTags() except ValueError: from tkinter import messagebox messagebox.showerror("Error", "No data set was loaded, please review your directories and credentials") # Class for Export class Export: def __init__(self, top=None): '''This class configures and populates the Export window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#00407f' # Closest X11 color: 'DodgerBlue4' _ana1color = '#7f7f00' # Closest X11 color: 'gold4' _ana2color = '#7f0000' # Closest X11 color: 'red4' font9 = "-family {Segoe UI} -size 9 -weight normal -slant " \ "roman -underline 0 -overstrike 0" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background= [('selected', _compcolor), ('active', _ana2color)]) self.style.map('.', foreground= [('selected', 'white'), ('active', 'white')]) top.geometry("600x333") top.title("Export") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.TLabelframe1 = ttk.Labelframe(top) self.TLabelframe1.place(relx=0.02, rely=0.03, relheight=0.56 , relwidth=0.33) self.TLabelframe1.configure(text='''Output User Info''') self.TLabelframe1.configure(width=200) self.usernameOutEnt = ttk.Entry(self.TLabelframe1) self.usernameOutEnt.place(relx=0.05, rely=0.32, relheight=0.14 , relwidth=0.83) self.usernameOutEnt.configure(textvariable=Simba_support.usernameOutVar) self.usernameOutEnt.configure(takefocus="") self.usernameOutEnt.configure(cursor="ibeam") self.passwordOutEnt = ttk.Entry(self.TLabelframe1) self.passwordOutEnt.place(relx=0.05, rely=0.76, relheight=0.14 , relwidth=0.83) self.passwordOutEnt.configure(textvariable=Simba_support.passwordOutVar) self.passwordOutEnt.configure(takefocus="") self.passwordOutEnt.configure(cursor="ibeam") self.usernameOutLab = ttk.Label(self.TLabelframe1) self.usernameOutLab.place(relx=0.05, rely=0.16, height=24, width=70) self.usernameOutLab.configure(background="#d9d9d9") self.usernameOutLab.configure(foreground="#000000") self.usernameOutLab.configure(relief=FLAT) self.usernameOutLab.configure(text='''Username''') self.passwordOutLab = ttk.Label(self.TLabelframe1) self.passwordOutLab.place(relx=0.05, rely=0.54, height=24, width=66) self.passwordOutLab.configure(background="#d9d9d9") self.passwordOutLab.configure(foreground="#000000") self.passwordOutLab.configure(relief=FLAT) self.passwordOutLab.configure(text='''Password''') self.urlOutLabFrame = ttk.Labelframe(top) self.urlOutLabFrame.place(relx=0.37, rely=0.03, relheight=0.56 , relwidth=0.58) self.urlOutLabFrame.configure(text='''Url Selection''') self.urlOutLabFrame.configure(width=350) self.projectOutEnt = ttk.Entry(self.urlOutLabFrame) self.projectOutEnt.place(relx=0.03, rely=0.32, relheight=0.14 , relwidth=0.47) self.projectOutEnt.configure(textvariable=Simba_support.projectOutVar) self.projectOutEnt.configure(takefocus="") self.projectOutEnt.configure(cursor="ibeam") self.projectOutLab = ttk.Label(self.urlOutLabFrame) self.projectOutLab.place(relx=0.03, rely=0.16, height=24, width=50) self.projectOutLab.configure(background="#d9d9d9") self.projectOutLab.configure(foreground="#000000") self.projectOutLab.configure(relief=FLAT) self.projectOutLab.configure(text='''Project''') self.urlOutEnt = ttk.Entry(self.urlOutLabFrame) self.urlOutEnt.place(relx=0.03, rely=0.76, relheight=0.14, relwidth=0.7) self.urlOutEnt.configure(textvariable=Simba_support.urlOutVar) self.urlOutEnt.configure(takefocus="") self.urlOutEnt.configure(cursor="ibeam") self.buildUrlOutButton = ttk.Button(self.urlOutLabFrame) self.buildUrlOutButton.place(relx=0.57, rely=0.32, height=30, width=98) self.buildUrlOutButton.configure( command=lambda: [Simba_support.projectOutVar.set(self.projectOutEnt.get()), Simba_support.urlOutVar.set(Simba_support.buildUrlOut()), self.urlOutEnt.delete(0,END),self.urlOutEnt.insert(END,Simba_support.urlOutVar.get())]) self.buildUrlOutButton.configure(takefocus="") self.buildUrlOutButton.configure(text='''Build Url''') self.urlOutLab = ttk.Label(self.urlOutLabFrame) self.urlOutLab.place(relx=0.03, rely=0.54, height=24, width=30) self.urlOutLab.configure(background="#d9d9d9") self.urlOutLab.configure(foreground="#000000") self.urlOutLab.configure(relief=FLAT) self.urlOutLab.configure(text='''URL''') self.pushDataButton = ttk.Button(self.urlOutLabFrame) self.pushDataButton.place(relx=0.77, rely=0.76, height=30, width=58) self.pushDataButton.configure(command=lambda: setPushDataSet()) self.pushDataButton.configure(takefocus="") self.pushDataButton.configure(text='''Export''') def setPushDataSet(): Simba_support.usernameOutVar.set(self.usernameOutEnt.get()) Simba_support.passwordOutVar.set(self.passwordOutEnt.get()) Simba_support.projectOutVar.set(self.projectOutEnt.get()) Simba_support.nameChangeVar.set(self.renameSeriesEnt.get()) Simba_support.urlOutVar.set(self.urlOutEnt.get()) Simba_support.pushDataSet() self.optionalOutLabFrame = ttk.Labelframe(top) self.optionalOutLabFrame.place(relx=0.02, rely=0.6, relheight=0.32 , relwidth=0.33) self.optionalOutLabFrame.configure(text='''Optional''') self.optionalOutLabFrame.configure(width=200) self.renameSeriesEnt = ttk.Entry(self.optionalOutLabFrame) self.renameSeriesEnt.place(relx=0.05, rely=0.57, relheight=0.25 , relwidth=0.83) self.renameSeriesEnt.configure(textvariable=Simba_support.nameChangeVar) self.renameSeriesEnt.configure(takefocus="") self.renameSeriesEnt.configure(cursor="ibeam") self.renameLab = ttk.Label(self.optionalOutLabFrame) self.renameLab.place(relx=0.05, rely=0.29, height=24, width=121) self.renameLab.configure(background="#d9d9d9") self.renameLab.configure(foreground="#000000") self.renameLab.configure(relief=FLAT) self.renameLab.configure(text='''New Series Name''') self.menubar = Menu(top, font=font9, bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar) def enableOnLoad(): if Simba_support.enableLoadVar: self.file.entryconfig("Save As", state=NORMAL) self.file.entryconfig("Clear Data", state=NORMAL) self.file.entryconfig("Export", state=NORMAL) def disableOnLoad(): if not Simba_support.enableLoadVar: self.file.entryconfig("Save As", state=DISABLED) self.file.entryconfig("Clear Data", state=DISABLED) self.file.entryconfig("Export", state=DISABLED) # Class for export Frame # Sub Panel Methods # Sub Window for the exporting to hosted service def openExportPanel(): def initEx(topEx, guiEx, *args, **kwargs): global wEx, top_levelEx, rootEx wEx = guiEx top_levelEx = topEx rootEx = topEx global valEx, wEx, rootEx rootEx = Tk() topEx = Export(rootEx) initEx(rootEx, topEx) rootEx.mainloop() # Sub window for log/pulling data from hosted service def openHostPanel(): def initHs(topHs, guiHs, *args, **kwargs): global wHs, top_levelHs, rootHs wHs = guiHs top_levelHs = topHs rootHs = topHs try: Simba_support.enableLoadVar = True global valHs, wHs, rootHs rootHs = Tk() topHs = Hosted_Service(rootHs) initHs(rootHs, topHs) rootHs.mainloop() except: pass
) # 创建一个按钮, text:显示按钮上面显示的文字, command:当这个按钮被点击之后会调用command函数 action.grid(column=2, row=1) # 设置其在界面中出现的位置 column代表列 row 代表行 # 文本框 name = tk.StringVar( ) # StringVar是Tk库内部定义的字符串变量类型,在这里用于管理部件上面的字符;不过一般用在按钮button上。改变StringVar,按钮上的文字也随之改变。 nameEntered = ttk.Entry( win, width=12, textvariable=name ) # 创建一个文本框,定义长度为12个字符长度,并且将文本框中的内容绑定到上一句定义的name变量上,方便clickMe调用 nameEntered.grid(column=0, row=1) # 设置其在界面中出现的位置 column代表列 row 代表行 nameEntered.focus() # 当程序运行时,光标默认会出现在该文本框中 # 创建一个下拉列表 number = tk.StringVar() numberChosen = ttk.Combobox(win, width=12, textvariable=number, state='readonly') numberChosen['values'] = (1, 2, 4, 42, 100) # 设置下拉列表的值 numberChosen.grid(column=1, row=1) # 设置其在界面中出现的位置 column代表列 row 代表行 numberChosen.current(0) # 设置下拉列表默认显示的值,0为 numberChosen['values'] 的下标值 # 复选框 chVarDis = tk.IntVar( ) # 用来获取复选框是否被勾选,通过chVarDis.get()来获取其的状态,其状态值为int类型 勾选为1 未勾选为0 check1 = tk.Checkbutton( win, text="Disabled", variable=chVarDis, state='disabled' ) # text为该复选框后面显示的名称, variable将该复选框的状态赋值给一个变量,当state='disabled'时,该复选框为灰色,不能点的状态 check1.select() # 该复选框是否勾选,select为勾选, deselect为不勾选 check1.grid( column=0, row=4, sticky=tk.W ) # sticky=tk.W 当该列中其他行或该行中的其他列的某一个功能拉长这列的宽度或高度时,设定该值可以保证本行保持左对齐,N:北/上对齐 S:南/下对齐 W:西/左对齐 E:东/右对齐
def sendGift(*args): idxs = lbox.curselection() if len(idxs) == 1: idx = int(idxs[0]) lbox.see(idx) name = nombreagentes[idx] if gifts[gift.get( )] == "Agregar agente": #Abrir ventana para agregar agente win = tk.Toplevel(root) frame1 = Frame(win) frame1.pack() Label(frame1, text="Nombre").grid(row=0, column=0, sticky=W) nombreVar = StringVar() nombre = Entry(frame1, textvariable=nombreVar) nombre.grid(row=0, column=1, sticky=W) Label(frame1, text="Version SNMP").grid(row=1, column=0, sticky=W) versionVar = StringVar() version = Entry(frame1, textvariable=versionVar) version.grid(row=1, column=1, sticky=W) Label(frame1, text="Comunidad").grid(row=2, column=0, sticky=W) comunidadVar = StringVar() comunidad = Entry(frame1, textvariable=comunidadVar) comunidad.grid(row=2, column=1, sticky=W) frame2 = Frame(win) # Row of buttons frame2.pack() b1 = Button(frame2, text="Agregar agente", command=lambda: agregarAgente(win, nombreVar.get( ), versionVar.get(), comunidadVar.get())) b1.pack(side=LEFT) elif gifts[gift.get()] == "Eliminar agente": #Eliminar agente lbox.delete(ANCHOR) #Elimina agente seleccionado de la lista crudagentes.eliminaragente(name) #Elimina agente del xml FuncionesSNMP.AgregarMultiProceso() elif gifts[gift.get( )] == "Ver estado del agente": # Muestra informacion del agente win = tk.Toplevel(root) frame = Frame(win) frame.pack() Label(frame, text="Nombre").grid(row=0, column=0, sticky=W) nombreVar = StringVar() nombre = Entry(frame, textvariable=nombreVar) nombre.grid(row=0, column=1, sticky=W) Label(frame, text="Sistema").grid(row=0, column=2, sticky=W) sistemaVar = StringVar() sistema = Entry(frame, textvariable=sistemaVar) sistema.grid(row=0, column=3, sticky=W) Label(frame, text="Ubicacion").grid(row=0, column=4, sticky=W) ubicacionVar = StringVar() ubicacion = Entry(frame, textvariable=ubicacionVar) ubicacion.grid(row=0, column=5, sticky=W) names = crudagentes.nombres() names.append('') nombresCB = StringVar() cbp2 = Label(frame, text="Host") cbp2.grid(row=1, column=0, sticky=W) cb2 = ttk.Combobox(frame, values=names, state='readonly', textvariable=nombresCB) cb2.grid(row=1, column=1, sticky=W) cb2.bind("<<ComboboxSelected>>", newselection(cb2)) cities = crudagentes.ubicaciones() cities.append('') ubicacionCB = StringVar() cbp3 = Label(frame, text="Ubicacion") cbp3.grid(row=1, column=2, sticky=W) cb3 = ttk.Combobox(frame, values=cities, state='readonly', textvariable=ubicacionCB) cb3.grid(row=1, column=3, sticky=W) cb3.bind("<<ComboboxSelected>>", newselection(cb3)) sos = crudagentes.sistemasoperativos() sos.append('') soCB = StringVar() cbp4 = Label(frame, text="Sistema operativo") cbp4.grid(row=1, column=4, sticky=W) cb4 = ttk.Combobox(frame, values=sos, state='readonly', textvariable=soCB) cb4.grid(row=1, column=5, sticky=W) cb4.bind("<<ComboboxSelected>>", newselection(cb4)) frame1 = Frame(win) frame1.pack() tree = ttk.Treeview(win) tree["columns"] = ("Nombre", "Version", "Sistema-Operativo", "Ubicacion-geografica", "Puertos", "Tiempo-actividad") tree.column("Nombre", width=100) tree.column("Version", width=50) tree.column("Sistema-Operativo", width=100) tree.column("Ubicacion-geografica", width=200) tree.column("Puertos", width=50) tree.column("Tiempo-actividad", width=150) tree.heading("Nombre", text="Nombre") tree.heading("Version", text="Version") tree.heading("Sistema-Operativo", text="Sistema Operativo") tree.heading("Ubicacion-geografica", text="Ubicacion geografica") tree.heading("Puertos", text="# Puertos") tree.heading("Tiempo-actividad", text="Tiempo de actividad") for nombreAgente in crudagentes.consultaragentes(): tree.insert( "", 0, values=(nombreAgente, crudagentes.consultarversion(nombreAgente), crudagentes.consultarso(nombreAgente), crudagentes.consultarubicacion(nombreAgente), crudagentes.consultarpuertos(nombreAgente), crudagentes.consultartiempo(nombreAgente))) tree.pack() b1 = Button(frame1, text="Buscar", command=lambda: buscarAgente(win, tree, nombreVar.get( ), sistemaVar.get(), ubicacionVar.get(), nombresCB.get( ), ubicacionCB.get(), soCB.get())) b1.grid(row=0, column=6, sticky=W) win.mainloop() elif gifts[gift.get( )] == "Ver graficas del agente": # Muestra las graficas del agente win = tk.Toplevel(root) frame1 = Frame(win) frame1.pack() uptime = FuncionesSNMP.consultaSNMP( str(crudagentes.consultarcomunidad(name)), name, '1.3.6.1.2.1.1.3.0') contacto = FuncionesSNMP.consultaSNMP( str(crudagentes.consultarcomunidad(name)), name, '1.3.6.1.2.1.1.4.0') nomb = FuncionesSNMP.consultaSNMP( str(crudagentes.consultarcomunidad(name)), name, '1.3.6.1.2.1.1.5.0') ubicac = FuncionesSNMP.consultaSNMP( str(crudagentes.consultarcomunidad(name)), name, '1.3.6.1.2.1.1.6.0') servicios = FuncionesSNMP.consultaSNMP( str(crudagentes.consultarcomunidad(name)), name, '1.3.6.1.2.1.1.7.0') Label(frame1, text="Nombre: ").grid(row=0, column=0) Label(frame1, text=nomb).grid(row=0, column=1) Label(frame1, text="Servicios: ").grid(row=0, column=2) Label(frame1, text=servicios).grid(row=0, column=3) Label(frame1, text="Ubicacion: ").grid(row=0, column=4) Label(frame1, text=ubicac).grid(row=0, column=5) Label(frame1, text="Contacto: ").grid(row=0, column=6) Label(frame1, text=contacto).grid(row=0, column=7) Label(frame1, text="Encendido desde: ").grid(row=0, column=8) Label(frame1, text=uptime).grid(row=0, column=9) #image_icmp = Image.open(name + "_ICMP.png") #icmp = ImageTk.PhotoImage(image_icmp) # icmp_ = Label(win, image=icmp); # icmp_.image = icmp # <== this is were we anchor the img object # icmp_.configure(image=icmp) # icmp_.grid(column=0) #icmp_.pack(side=LEFT) #image_ips = Image.open(name + "_IPs.png") #ips = ImageTk.PhotoImage(image_ips) #ips_ = Label(win, image=ips); #ips_.image = ips # <== this is were we anchor the img object #ips_.configure(image=ips) # ips_.grid(column=0) #ips_.pack(side=BOTTOM) image_icmppack = Image.open(name + "_SNMPPackets.png") icmppack = ImageTk.PhotoImage(image_icmppack) icmppack_ = Label(win, image=icmppack) icmppack_.image = icmppack # <== this is were we anchor the img object icmppack_.configure(image=icmppack) icmppack_.bind( "<Button-1>", lambda e, url=url: open_url(name + "_SNMPPackets.png")) #icmppack_.grid(column=0) icmppack_.pack(side=BOTTOM) image_tcpcon = Image.open(name + "_TCPConnections.png") tcpcon = ImageTk.PhotoImage(image_tcpcon) tcpcon_ = Label(win, image=tcpcon) tcpcon_.image = tcpcon # <== this is were we anchor the img object tcpcon_.configure(image=tcpcon) tcpcon_.bind( "<Button-1>", lambda e, url=url: open_url(name + "_TCPConnections.png")) # tcpcon_.grid(column=0) tcpcon_.pack(side=BOTTOM) image_tcpseg = Image.open(name + "_TCPSegments.png") tcpseg = ImageTk.PhotoImage(image_tcpseg) tcpseg_ = Label(win, image=tcpseg) tcpseg_.image = tcpseg # <== this is were we anchor the img object tcpseg_.configure(image=tcpseg) tcpseg_.bind( "<Button-1>", lambda e, url=url: open_url(name + "_TCPSegments.png")) #tcpseg_.grid(column=0) tcpseg_.pack()
def __init__(self, master=None): global serialconfig _bgcolor = 'wheat' # X11 color: #f5deb3 _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) master.configure(background="#d0d0d0") master.configure(highlightbackground="#d9d9d9") master.configure(highlightcolor="black") self.btn_Save = Button(master) self.btn_Save.place(relx=0.34, rely=0.74, height=24, width=87) self.btn_Save.configure(activebackground="#c0c0c0") self.btn_Save.configure(activeforeground="#000000") self.btn_Save.configure(background="#d0d0d0") # self.btn_Save.configure(command=comportconfig_support.Close) self.btn_Save.configure(command=comportconfig_support.close) self.btn_Save.configure(disabledforeground="#a3a3a3") self.btn_Save.configure(foreground="#000000") self.btn_Save.configure(highlightbackground="#d0d0d0") self.btn_Save.configure(highlightcolor="black") self.btn_Save.configure(pady="0") self.btn_Save.configure(text='''Save&Close''') self.btn_Cancel = Button(master) self.btn_Cancel.place(relx=0.68, rely=0.74, height=24, width=87) self.btn_Cancel.configure(activebackground="#d0d0d0") self.btn_Cancel.configure(activeforeground="#000000") self.btn_Cancel.configure(background="#d0d0d0") self.btn_Cancel.configure(command=comportconfig_support.cancel) self.btn_Cancel.configure(disabledforeground="#a3a3a3") self.btn_Cancel.configure(foreground="#000000") self.btn_Cancel.configure(highlightbackground="#d0d0d0") self.btn_Cancel.configure(highlightcolor="black") self.btn_Cancel.configure(pady="0") self.btn_Cancel.configure(text='''Cancel''') self.Labelframe1 = LabelFrame(master) self.Labelframe1.place(relx=0.1, rely=0.06, relheight=0.58, relwidth=0.86) self.Labelframe1.configure(relief=GROOVE) self.Labelframe1.configure(foreground="black") self.Labelframe1.configure(text='''Comport settings''') self.Labelframe1.configure(background="#d0d0d0") self.Labelframe1.configure(highlightbackground="#d9d9d9") self.Labelframe1.configure(highlightcolor="black") self.Labelframe1.configure(width=255) self.Label1 = Label(self.Labelframe1) self.Label1.place(relx=0.04, rely=0.21, height=21, width=54) self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(activeforeground="black") self.Label1.configure(background="#d0d0d0") self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(foreground="#000000") self.Label1.configure(highlightbackground="#d9d9d9") self.Label1.configure(highlightcolor="black") self.Label1.configure(text='''Comport''') self.Label2 = Label(self.Labelframe1) self.Label2.place(relx=0.04, rely=0.53, height=21, width=53) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#d0d0d0") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''Baudrate''') comportconfig_support.Readconfig() baudrateindex = self.find_index( comportconfig_support.serialconfig['baudrate'], comportconfig_support.cbaudrates) # check if baudrate in list if baudrateindex < 0: baudrateindex = 0 # serial_portlist = serial.tools.list_ports.comports() # serial_ports = comportindex = self.find_index( comportconfig_support.serialconfig['comport'], listports.serial_ports()) # check if baudrate in list if comportindex < 0: print(' Port not found: ', serialconfig['comport']) comportindex = 0 print('Config: ', comportconfig_support.serialconfig) self.tc_baudrate = StringVar() self.tc_baudrate = ttk.Combobox(self.Labelframe1, textvariable=self.tc_baudrate) self.tc_baudrate.place(relx=0.35, rely=0.21, relheight=0.35, relwidth=0.56) self.tc_baudrate['values'] = comportconfig_support.cbaudrates self.tc_baudrate.current(baudrateindex) self.tc_baudrate.configure(takefocus="") self.tc_baudrate.bind('<<ComboboxSelected>>', self.set_baudrate) self.tc_comports = StringVar() self.tc_comport = ttk.Combobox(self.Labelframe1, textvariable=self.tc_comports) self.tc_comport.place(relx=0.35, rely=0.53, relheight=0.35, relwidth=0.56) self.tc_comport['values'] = listports.serial_ports() self.tc_comport.current(comportindex) self.tc_comport.bind('<<ComboboxSelected>>', self.set_comport) self.tc_comport.configure(takefocus="") print('baudrate: ', self.tc_baudrate['values']) print('ports: ', listports.serial_ports())
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() self.style.theme_use("clam") if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.',background=_bgcolor) self.style.configure('.',foreground=_fgcolor) self.style.configure('.',font="TkDefaultFont") self.style.map('.',background= [('selected', _compcolor), ('active',_ana2color)]) top.geometry("600x450") top.title("SerialComm @dfso") top.configure(highlightcolor="black") top.after(1000, self.ler_dados) self.Labelframe1 = LabelFrame(top) self.Labelframe1.place(relx=0.02, rely=0.02, relheight=0.21 , relwidth=0.55) self.Labelframe1.configure(relief=GROOVE) self.Labelframe1.configure(text='''Conexão''') self.Labelframe1.configure(width=330) self.Label1 = Label(self.Labelframe1) self.Label1.place(relx=0.03, rely=0.21, height=18, width=35, y=-11) self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(text='''Porta''') self.combobox_portas = ttk.Combobox(self.Labelframe1) self.combobox_portas.place(relx=0.42, rely=0.21, relheight=0.19 , relwidth=0.54, y=-11, h=11) #self.combobox_portas.configure(textvariable=serial_comm_support.combobox) self.combobox_portas.configure(takefocus="") self.combobox_bauds = ttk.Combobox(self.Labelframe1) self.combobox_bauds.place(relx=0.42, rely=0.53, relheight=0.19 , relwidth=0.54, y=-11, h=11) #self.combobox_bauds.configure(textvariable=serial_comm_support.combobox) self.combobox_bauds.configure(takefocus="") self.combobox_bauds['values'] = [9600, 115200] self.combobox_bauds.current(0) self.Label2 = Label(self.Labelframe1) self.Label2.place(relx=0.03, rely=0.53, height=18, width=66, y=-11) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(text='''Baud Rate''') self.Labelframe2 = LabelFrame(top) self.Labelframe2.place(relx=0.58, rely=0.02, relheight=0.21 , relwidth=0.4) self.Labelframe2.configure(relief=GROOVE) self.Labelframe2.configure(text='''Ações''') self.Labelframe2.configure(width=240) self.btn_desconectar = Button(self.Labelframe2) self.btn_desconectar.place(relx=0.04, rely=0.53, height=26, width=101 , y=-11) self.btn_desconectar.configure(activebackground="#d9d9d9") self.btn_desconectar.configure(text='''Desconectar''') self.btn_atualizar = Button(self.Labelframe2) self.btn_atualizar.place(relx=0.5, rely=0.21, height=54, width=104 , y=-11) self.btn_atualizar.configure(activebackground="#d9d9d9") self._img1 = PhotoImage(file="./imgs/icons8-atualizações-disponíveis-40.png") self.btn_atualizar.configure(image=self._img1) self.btn_conectar = Button(self.Labelframe2) self.btn_conectar.place(relx=0.04, rely=0.21, height=26, width=100 , y=-11) self.btn_conectar.configure(activebackground="#d9d9d9") self.btn_conectar.configure(text='''Conectar''') self.txt_log = Text(top) self.txt_log.place(relx=0.02, rely=0.27, relheight=0.65, relwidth=0.96) self.txt_log.configure(background="white") self.txt_log.configure(font="TkTextFont") self.txt_log.configure(selectbackground="#c4c4c4") self.txt_log.configure(undo="1") self.txt_log.configure(width=576) self.txt_log.configure(wrap=WORD) self.btn_sair = Button(top) self.btn_sair.place(relx=0.9, rely=0.93, height=26, width=49) self.btn_sair.configure(activebackground="#d9d9d9") self.btn_sair.configure(text='''Sair''') self.btn_sair.bind('<Button-1>',lambda e:serial_comm_support.btn_sair_clicked(e)) self.btn_atualizar['command'] = self.obtem_portas self.btn_conectar['command'] = self.conectar
win = tk.Tk() win.title("Python gui") def ClickMe(): action.configure(text="Hello " + name.get() + ' ' + numberChosen.get()) action = ttk.Button(win, text="Click Me!", command=ClickMe) action.grid(column=2, row=1) ttk.Label(win, text="Enter a name:").grid(column=0, row=0) ttk.Label(win, text="Choose a number:").grid(column=1, row=0) name = tk.StringVar() nameEntered = ttk.Entry(win, width=12, textvariable=name) nameEntered.focus() # place a cursor nameEntered.grid(column=0, row=1) number = tk.StringVar() numberChosen = ttk.Combobox(win, width=12, textvariable=number) # numberChosen = ttl.Combobox(win, width=12, # textvariable=number, state='readonly') # 禁止自己填写 numberChosen["values"] = [1, 2, 4, 42, 100] numberChosen.grid(column=1, row=1) numberChosen.current(1) # 选择默认value win.mainloop()
fenetre = Tk() #Principal Window fenetre.title('.....') #Title principalFrame = Frame(fenetre, borderwidth=5, width=500) principalFrame.pack() ###Choix du project NameProjectFrame = Frame(principalFrame) NameProjectFrame.pack() Label(NameProjectFrame, text="Project name : ").pack(side=LEFT) projectName = StringVar() projectNameList = ttk.Combobox(NameProjectFrame, width=20, textvariable=projectName) projectNameList['values'] = tuple([ proj for proj in os.listdir(path) if proj not in ["databases", "programme", "python", "run.exe", "readme.doc"] ]) projectNameList.current(0) projectNameList.pack(side=LEFT) selectProjectButton = Button(NameProjectFrame, text="select", command=selectProject) selectProjectButton.pack() ###Fin du choix du projet ###choix de la methode
def __init__(self, parent, controller): self.maincatdict = {} self.combotagdict = {} self.filterselected = None tk.Frame.__init__(self, parent) self.controller = controller # Frame to Display on Tree labelframedisplay = tk.LabelFrame(self, text="Display Options") labelframedisplay.grid(column=0, row=0, columnspan=2, rowspan=2, sticky='ew') buttonshowtagsselected = tk.Button( labelframedisplay, text='Show Tags for Selected Category') buttonshowtagsselected.my_name = "select" buttonshowtagsselected.bind('<Button-1>', self.show_categories_tree) buttonshowtagsselected.grid(column=0, row=2, in_=labelframedisplay) buttonshowtagsall = tk.Button(labelframedisplay, text='Show All Tags') buttonshowtagsall.my_name = "all" buttonshowtagsall.bind('<Button-1>', self.show_categories_tree) buttonshowtagsall.grid(column=0, row=1, sticky='ew', in_=labelframedisplay) # Frame to Modify Tags labelframeedittag = tk.LabelFrame(self, text="Category Add/Remove") labelframeedittag.grid(column=0, row=3, columnspan=1, rowspan=2, sticky='ew') buttonaddselectedtag = tk.Button(labelframeedittag, text='Add Category') buttonaddselectedtag.bind('<Button-1>', self.add_tag2category) buttonaddselectedtag.grid(column=0, row=3, sticky='ew', in_=labelframeedittag) buttondeletetagcat = tk.Button(labelframeedittag, text='Remove Category') buttondeletetagcat.bind('<Button-1>', self.del_tag2category) buttondeletetagcat.grid(column=0, row=4, sticky='ew', in_=labelframeedittag) # Show Combo Boxes labelselecttag = tk.LabelFrame(self, text="Category/Tag Select") labelselecttag.grid(column=2, row=0, columnspan=2, rowspan=2) self.combo01 = ttk.Combobox(labelselecttag) self.combo01.grid(column=3, row=3, in_=labelselecttag) mainlabel = tk.Label(labelselecttag, text="Category") mainlabel.grid(column=2, row=2) self.comboMain = ttk.Combobox(labelselecttag) self.comboMain.bind('<<ComboboxSelected>>', controller.maincat_combo_change) self.comboMain.grid(column=2, row=3, in_=labelselecttag) taglabel = tk.Label(labelselecttag, text="Tag") taglabel.grid(column=3, row=2) # Save Tag/Category labelsavetagcatcontainer = tk.LabelFrame(self, text="New Tag/Category") labelsavetagcatcontainer.grid(column=2, row=4, rowspan=2, columnspan=2, sticky='nsew') buttonaddcategory = tk.Button(labelsavetagcatcontainer, text='Add Main Category') buttonaddcategory.bind('<Button-1>', controller.addMainCat) buttonaddcategory.grid(column=0, row=0, in_=labelsavetagcatcontainer) buttonaddtag = tk.Button(labelsavetagcatcontainer, text='Add Tag') buttonaddtag.bind('<Button-1>', self.addtagdb) buttonaddtag.grid(column=1, row=0, in_=labelsavetagcatcontainer) self.entryfield = ttk.Entry(labelsavetagcatcontainer, ) self.entryfield.bind('<KeyRelease>') self.entryfield.grid(column=0, row=1, rowspan=2, sticky='ew', in_=labelsavetagcatcontainer) # Tag Box and Edit Functions tagcontainerspan = 5 self.labeltagcontainer = tk.LabelFrame(self, text="Edit Filter") self.labeltagcontainer.grid(column=4, row=0, rowspan=tagcontainerspan, columnspan=2, sticky='ns') self.tagcontainer = ttk.Frame(self, relief="groove") self.tagcontainer.grid(column=4, row=0, rowspan=tagcontainerspan, columnspan=2, sticky='ns', in_=self) self.filterentry = ttk.Entry(self) self.filterentry.bind('<KeyRelease>') self.filterentry.grid(column=0, row=tagcontainerspan - 2, columnspan=2, in_=self.labeltagcontainer) self.savetag = tk.Button(self, text='Save New Filter') self.savetag.bind('<Button-1>', self.savetagfilter) self.savetag.grid(column=0, row=tagcontainerspan - 1, sticky='ew', in_=self.labeltagcontainer) self.edittag = tk.Button(self, text='Save Filter') self.edittag.bind('<Button-1>', self.edittagsavefilter) self.edittag.grid(column=0, row=tagcontainerspan - 1, sticky='ew', in_=self.labeltagcontainer) self.edittag.grid_remove() self.deletetag = tk.Button(self, text='Remove Filter') self.deletetag.bind('<Button-1>', self.remove_filter_from_tag) self.deletetag.grid(column=1, row=tagcontainerspan - 1, sticky='ew', in_=self.labeltagcontainer) self.canceltag = tk.Button(self, text='Cancel') self.canceltag.bind('<Button-1>', self.cancelsavetagfilter) self.canceltag.grid(column=0, row=tagcontainerspan, sticky='ew', in_=self.labeltagcontainer) self.filterlist = tk.Listbox(self, height=3) self.filterlist.grid(column=0, row=0, rowspan=tagcontainerspan - 2, columnspan=2, in_=self.labeltagcontainer, sticky='nesw') self.filterlist.columnconfigure(0, weight=1) self.filterlist.bind('<<ListboxSelect>>', self.listboxfilterselect) button = tk.Button(self, text="Main", command=lambda: controller.show_frame("MainPage")) button.grid(column=1, row=6, in_=self) self.labeltagcontainer.grid_remove() self.deletetag.grid_remove() self.canceltag.grid_remove()
def createWidgets(self): #Photo background self.panel = Label(self,bg='black') self.panel.grid(row=0, rowspan=5, column=0, padx=50) self.imgFile= Image.open('bg.gif') self.imgBackground = ImageTk.PhotoImage(self.imgFile) self.lbBackground = Label(self, image=self.imgBackground) self.lbBackground.grid(row=0, rowspan=7, column=0, columnspan=5) #Quit self.QUIT = Button(self, text="Quit", command=self.quit) self.QUIT.grid(row=4, rowspan=2, column=4) #File or directory self.intVarFileDir = IntVar() self.intVarFileDir.set(0) self.rbtFile = Radiobutton(self, text="File", variable=self.intVarFileDir, value=0, bg='black', fg='white', selectcolor='black', command=lambda: self.selFileDir()) self.rbtFile.select() self.rbtFile.grid(row=0, column=2) self.rbtDir = Radiobutton(self, text="Folder", variable=self.intVarFileDir, value=1, bg='black', fg='white', selectcolor='black', command=lambda: self.selFileDir()) self.rbtDir.grid(row=0, column=3) #Browse file to de/en-crypt self.lbFileDir = Label(self, text="File:", bg='black', fg='white') self.lbFileDir.grid(row=1, column=1, sticky=E) self.etFileDir = Entry(self, width=50) self.etFileDir.grid(row=1, column=2, columnspan=2, sticky=W+E, padx=5) self.btFile = Button(self, text="Browse..", width=10, command=lambda: self.fileBrowse("file")) self.btFile.grid(row=1, column=4) #Browse directory to de/en-crypt self.btDir = Button(self, text="Browse..", width=10, command=lambda: self.dirBrowse("dir")) # self.btDir.grid(row=1, column=4) #Save to directory self.lbSaveDir = Label(self, text="Save to folder:", bg='black', fg='white') self.lbSaveDir.grid(row=2, column=1, sticky=E) self.etSaveDir = Entry(self, width=50) self.etSaveDir.grid(row=2, column=2, columnspan=2, sticky=W+E, padx=5) self.btSaveDir = Button(self, text="Browse..", width=10, command=lambda: self.dirBrowse("save")) self.btSaveDir.grid(row=2, column=4) #Browse key file self.lbKey = Label(self, text="Key:", bg='black', fg='white') self.lbKey.grid(row=3, column=1, sticky=E) self.etKey = Entry(self, width=50) self.etKey.grid(row=3, column=2, columnspan=2, sticky=W+E, padx=5) self.btKey = Button(self, text="Browse..", width=10, command=lambda: self.fileBrowse("key")) self.btKey.grid(row=3, column=4) #Algorithm self.lbAlgorithm = Label(self, text="Algorithm:", bg='black', fg='white') self.lbAlgorithm.grid(row=4, column=1, sticky=E) self.cbAlgorithm = ttk.Combobox(self, state="readonly", width=25) algorithm = ("AES", "DES", "RSA") self.cbAlgorithm["value"] = algorithm self.cbAlgorithm.set("AES") self.cbAlgorithm.grid(row=4, column=2, sticky=W, padx=5, pady=5) #Encrypt/Decrypt self.lbEnDeCrypt = Label(self, text="Encrypt/Decrypt:", bg='black', fg='white') self.lbEnDeCrypt.grid(row=5, column=1, sticky=E) self.cbEnDeCrypt = ttk.Combobox(self, state="readonly", width=25) enDeCrypt = ("Encrypt", "Decrypt") self.cbEnDeCrypt["value"] = enDeCrypt self.cbEnDeCrypt.set("Encrypt") self.cbEnDeCrypt.grid(row=5, column=2, sticky=W, padx=5, pady=5) #Start button self.btStart = Button(self, text="Start", width=10, command= lambda: self.startThread()) self.btStart.grid(row=4, rowspan=2, column=3, sticky=W) #Progress bar self.lbProgress = Label(self, text="Progress:", bg='black', fg='white') self.lbProgress.grid(row=6, column=1, sticky=E) self.progress = ttk.Progressbar(self, orient="horizontal", length=100, mode="determinate") self.progress.grid(row=6, column=2, sticky=W+E, padx=5, pady=5) self.strVarStatus = StringVar() self.lbStatus = Label(self, text="Idle", bg='black', fg='white') self.lbStatus.grid(row=6, column=3, sticky=W) self.strVarTime = StringVar() self.lbTime = Label(self, text="Time: 00:00", bg='black', fg='white') self.lbTime.grid(row=6, column=4, sticky=W)
def __init__(self, top=None): _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' font11 = "-family {Segoe UI} -size 14 -weight normal -slant " \ "roman -underline 0 -overstrike 0" font12 = "-family {Segoe UI} -size 16 -weight bold -slant " \ "roman -underline 0 -overstrike 0" font13 = "-family {Segoe UI} -size 14 -weight bold -slant " \ "roman -underline 0 -overstrike 0" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("1252x798+297+123") top.minsize(148, 1) top.maxsize(1924, 1055) top.resizable(1, 1) top.title("New Toplevel") top.configure(background="#001240") self.Frame1 = tk.Frame(top) self.Frame1.place(relx=0.016, rely=0.088, relheight=0.683, relwidth=0.363) self.Frame1.configure(relief='groove') self.Frame1.configure(borderwidth="2") self.Frame1.configure(relief="groove") self.Frame1.configure(background="#30b9d1") self.Label4 = tk.Label(self.Frame1) self.Label4.place(relx=0.308, rely=0.037, height=37, width=196) self.Label4.configure(background="#d9d9d9") self.Label4.configure(disabledforeground="#a3a3a3") self.Label4.configure(font=font11) self.Label4.configure(foreground="#000000") self.Label4.configure(state='active') self.Label4.configure(text='''Manage Employee''') self.deplbl = tk.Label(self.Frame1) self.deplbl.place(relx=0.066, rely=0.165, height=26, width=93) self.deplbl.configure(background="#d9d9d9") self.deplbl.configure(disabledforeground="#a3a3a3") self.deplbl.configure(foreground="#000000") self.deplbl.configure(text='''Department :''') self.idlbl = tk.Label(self.Frame1) self.idlbl.place(relx=0.066, rely=0.275, height=26, width=96) self.idlbl.configure(background="#d9d9d9") self.idlbl.configure(disabledforeground="#a3a3a3") self.idlbl.configure(foreground="#000000") self.idlbl.configure(text='''Employee id :''') self.namelbl = tk.Label(self.Frame1) self.namelbl.place(relx=0.088, rely=0.367, height=26, width=42) self.namelbl.configure(activebackground="#f9f9f9") self.namelbl.configure(activeforeground="black") self.namelbl.configure(background="#d9d9d9") self.namelbl.configure(disabledforeground="#a3a3a3") self.namelbl.configure(foreground="#000000") self.namelbl.configure(highlightbackground="#d9d9d9") self.namelbl.configure(highlightcolor="black") self.namelbl.configure(text='''Name :''') self.emaillbl = tk.Label(self.Frame1) self.emaillbl.place(relx=0.088, rely=0.459, height=26, width=50) self.emaillbl.configure(background="#d9d9d9") self.emaillbl.configure(disabledforeground="#a3a3a3") self.emaillbl.configure(foreground="#000000") self.emaillbl.configure(text='''Email :''') self.glbl = tk.Label(self.Frame1) self.glbl.place(relx=0.066, rely=0.587, height=26, width=61) self.glbl.configure(background="#d9d9d9") self.glbl.configure(disabledforeground="#a3a3a3") self.glbl.configure(foreground="#000000") self.glbl.configure(text='''Gender :''') self.phnolbl = tk.Label(self.Frame1) self.phnolbl.place(relx=0.066, rely=0.716, height=26, width=88) self.phnolbl.configure(background="#d9d9d9") self.phnolbl.configure(disabledforeground="#a3a3a3") self.phnolbl.configure(foreground="#000000") self.phnolbl.configure(text='''Contact No :''') self.addrlbl = tk.Label(self.Frame1) self.addrlbl.place(relx=0.088, rely=0.844, height=26, width=66) self.addrlbl.configure(background="#d9d9d9") self.addrlbl.configure(disabledforeground="#a3a3a3") self.addrlbl.configure(foreground="#000000") self.addrlbl.configure(text='''Address :''') self.DepCbox = ttk.Combobox(self.Frame1) self.DepCbox.place(relx=0.484, rely=0.165, relheight=0.048, relwidth=0.411) self.DepCbox.configure(textvariable=seconddd_support.combobox) self.DepCbox.configure(takefocus="") self.DepCbox['value'] = self.combo_input() self.idobx = tk.Entry(self.Frame1) self.idobx.place(relx=0.484, rely=0.275, height=24, relwidth=0.404) self.idobx.configure(background="white") self.idobx.configure(disabledforeground="#a3a3a3") self.idobx.configure(font="-family {Courier New} -size 10") self.idobx.configure(foreground="#000000") self.idobx.configure(insertbackground="black") self.NameBox = tk.Entry(self.Frame1) self.NameBox.place(relx=0.484, rely=0.367, height=24, relwidth=0.448) self.NameBox.configure(background="white") self.NameBox.configure(disabledforeground="#a3a3a3") self.NameBox.configure(font="-family {Courier New} -size 10") self.NameBox.configure(foreground="#000000") self.NameBox.configure(insertbackground="black") self.EmailBox = tk.Entry(self.Frame1) self.EmailBox.place(relx=0.484, rely=0.477, height=24, relwidth=0.448) self.EmailBox.configure(background="white") self.EmailBox.configure(disabledforeground="#a3a3a3") self.EmailBox.configure(font="-family {Courier New} -size 10") self.EmailBox.configure(foreground="#000000") self.EmailBox.configure(insertbackground="black") self.phBox = tk.Entry(self.Frame1) self.phBox.place(relx=0.484, rely=0.716, height=24, relwidth=0.448) self.phBox.configure(background="white") self.phBox.configure(disabledforeground="#a3a3a3") self.phBox.configure(font="-family {Courier New} -size 10") self.phBox.configure(foreground="#000000") self.phBox.configure(insertbackground="black") self.addrBox = tk.Text(self.Frame1) self.addrBox.place(relx=0.484, rely=0.844, relheight=0.117, relwidth=0.448) self.addrBox.configure(background="white") self.addrBox.configure(font="-family {Segoe UI} -size 9") self.addrBox.configure(foreground="black") self.addrBox.configure(highlightbackground="#d9d9d9") self.addrBox.configure(highlightcolor="black") self.addrBox.configure(insertbackground="black") self.addrBox.configure(selectbackground="#c4c4c4") self.addrBox.configure(selectforeground="black") self.addrBox.configure(wrap="word") self.GCbox = ttk.Combobox(self.Frame1) self.GCbox.place(relx=0.484, rely=0.587, relheight=0.048, relwidth=0.411) self.GCbox.configure(textvariable=tk.StringVar()) self.GCbox.configure(takefocus="") self.GCbox['values'] = ('Male', 'Female', 'Others') self.Frame2 = tk.Frame(top) self.Frame2.place(relx=0.415, rely=0.088, relheight=0.47, relwidth=0.547) self.Frame2.configure(relief='groove') self.Frame2.configure(borderwidth="2") self.Frame2.configure(relief="groove") self.Frame2.configure(background="#f053dd") self.ListBox1 = tk.Listbox(self.Frame2) self.ListBox1.place(relx=0.029, rely=0.133, relheight=0.821, relwidth=0.955) self.ListBox1.configure(background="white") self.ListBox1.configure(disabledforeground="#a3a3a3") self.ListBox1.configure(font="-family {Courier New} -size 10") self.ListBox1.configure(foreground="#000000") self.searchCbox = ttk.Combobox(self.Frame2) self.searchCbox.place(relx=0.204, rely=0.027, relheight=0.069, relwidth=0.2) self.searchCbox.configure(textvariable=tk.StringVar()) self.searchCbox.configure(takefocus="") self.searchCbox['value'] = ('Employeee ID', 'Name') self.searchbox = tk.Entry(self.Frame2) self.searchbox.place(relx=0.423, rely=0.027, height=24, relwidth=0.225) self.searchbox.configure(background="white") self.searchbox.configure(disabledforeground="#a3a3a3") self.searchbox.configure(font="-family {Courier New} -size 10") self.searchbox.configure(foreground="#000000") self.searchbox.configure(insertbackground="black") self.search = tk.Button(self.Frame2) self.search.place(relx=0.686, rely=0.027, height=33, width=96) self.search.configure(activebackground="#ececec") self.search.configure(activeforeground="#000000") self.search.configure(background="#d9d9d9") self.search.configure(disabledforeground="#a3a3a3") self.search.configure(foreground="#000000") self.search.configure(highlightbackground="#d9d9d9") self.search.configure(highlightcolor="black") self.search.configure(pady="0") self.search.configure(text='''search''') self.showbtn2 = tk.Button(self.Frame2) self.showbtn2.place(relx=0.847, rely=0.027, height=33, width=86) self.showbtn2.configure(activebackground="#ececec") self.showbtn2.configure(activeforeground="#000000") self.showbtn2.configure(background="#d9d9d9") self.showbtn2.configure(disabledforeground="#a3a3a3") self.showbtn2.configure(foreground="#000000") self.showbtn2.configure(highlightbackground="#d9d9d9") self.showbtn2.configure(highlightcolor="black") self.showbtn2.configure(pady="0") self.showbtn2.configure(command=self.show2btn_click, text='''Show ALL''') self.Searchlbl = tk.Label(self.Frame2) self.Searchlbl.place(relx=0.044, rely=0.027, height=26, width=82) self.Searchlbl.configure(background="#d9d9d9") self.Searchlbl.configure(disabledforeground="#a3a3a3") self.Searchlbl.configure(foreground="#000000") self.Searchlbl.configure(text='''Search by''') self.Frame3 = tk.Frame(top) self.Frame3.place(relx=0.415, rely=0.589, relheight=0.382, relwidth=0.547) self.Frame3.configure(relief='groove') self.Frame3.configure(borderwidth="2") self.Frame3.configure(relief="groove") self.Frame3.configure(background="#0a6365") self.Frame4 = tk.Frame(self.Frame3) self.Frame4.place(relx=0.044, rely=0.689, relheight=0.246, relwidth=0.504) self.Frame4.configure(relief='groove') self.Frame4.configure(borderwidth="2") self.Frame4.configure(relief="groove") self.Frame4.configure(background="#936798") self.depaddbtn = tk.Button(self.Frame4) self.depaddbtn.place(relx=0.087, rely=0.267, height=33, width=96) self.depaddbtn.configure(activebackground="#ececec") self.depaddbtn.configure(activeforeground="#000000") self.depaddbtn.configure(background="#d9d9d9") self.depaddbtn.configure(disabledforeground="#a3a3a3") self.depaddbtn.configure(foreground="#000000") self.depaddbtn.configure(highlightbackground="#d9d9d9") self.depaddbtn.configure(highlightcolor="black") self.depaddbtn.configure(pady="0") self.depaddbtn.configure(command=self.depaddbtn_click, text='''Add''') self.Depdelbtn = tk.Button(self.Frame4) self.Depdelbtn.place(relx=0.435, rely=0.267, height=33, width=86) self.Depdelbtn.configure(activebackground="#ececec") self.Depdelbtn.configure(activeforeground="#000000") self.Depdelbtn.configure(background="#d9d9d9") self.Depdelbtn.configure(disabledforeground="#a3a3a3") self.Depdelbtn.configure(foreground="#000000") self.Depdelbtn.configure(highlightbackground="#d9d9d9") self.Depdelbtn.configure(highlightcolor="black") self.Depdelbtn.configure(pady="0") self.Depdelbtn.configure(command=self.Depdelbtn_click, text='''Delete''') self.depshow = tk.Button(self.Frame4) self.depshow.place(relx=0.725, rely=0.267, height=33, width=76) self.depshow.configure(activebackground="#ececec") self.depshow.configure(activeforeground="#000000") self.depshow.configure(background="#d9d9d9") self.depshow.configure(disabledforeground="#a3a3a3") self.depshow.configure(foreground="#000000") self.depshow.configure(highlightbackground="#d9d9d9") self.depshow.configure(highlightcolor="black") self.depshow.configure(pady="0") self.depshow.configure(text='''Show All''') self.depshow.configure(command=self.depshowbtn_click) self.Listbox2 = tk.Listbox(self.Frame3) self.Listbox2.place(relx=0.584, rely=0.033, relheight=0.911, relwidth=0.4) self.Listbox2.configure(background="white") self.Listbox2.configure(disabledforeground="#a3a3a3") self.Listbox2.configure(font="-family {Courier New} -size 10") self.Listbox2.configure(foreground="#000000") self.Deplbl = tk.Label(self.Frame3) self.Deplbl.place(relx=0.015, rely=0.033, height=36, width=312) self.Deplbl.configure(background="#d9d9d9") self.Deplbl.configure(disabledforeground="#a3a3a3") self.Deplbl.configure(font=font13) self.Deplbl.configure(foreground="#000000") self.Deplbl.configure(state='active') self.Deplbl.configure(text='''Department Management''') self.Depidbox = tk.Entry(self.Frame3) self.Depidbox.place(relx=0.263, rely=0.262, height=24, relwidth=0.269) self.Depidbox.configure(background="white") self.Depidbox.configure(disabledforeground="#a3a3a3") self.Depidbox.configure(font="-family {Courier New} -size 10") self.Depidbox.configure(foreground="#000000") self.Depidbox.configure(highlightbackground="#d9d9d9") self.Depidbox.configure(highlightcolor="black") self.Depidbox.configure(insertbackground="black") self.Depidbox.configure(selectbackground="#c4c4c4") self.Depidbox.configure(selectforeground="black") self.DepBox2 = tk.Entry(self.Frame3) self.DepBox2.place(relx=0.263, rely=0.492, height=24, relwidth=0.269) self.DepBox2.configure(background="white") self.DepBox2.configure(disabledforeground="#a3a3a3") self.DepBox2.configure(font="-family {Courier New} -size 10") self.DepBox2.configure(foreground="#000000") self.DepBox2.configure(insertbackground="black") self.dep2lbl = tk.Label(self.Frame3) self.dep2lbl.place(relx=0.029, rely=0.492, height=26, width=142) self.dep2lbl.configure(background="#d9d9d9") self.dep2lbl.configure(disabledforeground="#a3a3a3") self.dep2lbl.configure(foreground="#000000") self.dep2lbl.configure(text='''Department Name :''') self.depid = tk.Label(self.Frame3) self.depid.place(relx=0.044, rely=0.262, height=26, width=122) self.depid.configure(background="#d9d9d9") self.depid.configure(disabledforeground="#a3a3a3") self.depid.configure(foreground="#000000") self.depid.configure(text='''ID''') self.Frame5 = tk.Frame(top) self.Frame5.place(relx=0.016, rely=0.789, relheight=0.182, relwidth=0.363) self.Frame5.configure(relief='groove') self.Frame5.configure(borderwidth="2") self.Frame5.configure(relief="groove") self.Frame5.configure(background="#b96046") self.Addbtn = tk.Button(self.Frame5) self.Addbtn.place(relx=0.066, rely=0.138, height=33, width=106) self.Addbtn.configure(activebackground="#ececec") self.Addbtn.configure(activeforeground="#000000") self.Addbtn.configure(background="#d9d9d9") self.Addbtn.configure(disabledforeground="#a3a3a3") self.Addbtn.configure(foreground="#000000") self.Addbtn.configure(highlightbackground="#d9d9d9") self.Addbtn.configure(highlightcolor="black") self.Addbtn.configure(pady="0") self.Addbtn.configure(command=self.Addbtn_click, text='''Add''') self.Delbtn = tk.Button(self.Frame5) self.Delbtn.place(relx=0.374, rely=0.138, height=33, width=106) self.Delbtn.configure(activebackground="#ececec") self.Delbtn.configure(activeforeground="#000000") self.Delbtn.configure(background="#d9d9d9") self.Delbtn.configure(disabledforeground="#a3a3a3") self.Delbtn.configure(foreground="#000000") self.Delbtn.configure(highlightbackground="#d9d9d9") self.Delbtn.configure(highlightcolor="black") self.Delbtn.configure(pady="0") self.Delbtn.configure(command=self.Delbtn_click, text='''Delete''') self.clrbtn = tk.Button(self.Frame5) self.clrbtn.place(relx=0.132, rely=0.621, height=33, width=126) self.clrbtn.configure(activebackground="#ececec") self.clrbtn.configure(activeforeground="#000000") self.clrbtn.configure(background="#d9d9d9") self.clrbtn.configure(disabledforeground="#a3a3a3") self.clrbtn.configure(foreground="#000000") self.clrbtn.configure(highlightbackground="#d9d9d9") self.clrbtn.configure(highlightcolor="black") self.clrbtn.configure(pady="0") self.clrbtn.configure(text='''Clear''') self.addfacebtn = tk.Button(self.Frame5) self.addfacebtn.place(relx=0.484, rely=0.621, height=33, width=126) self.addfacebtn.configure(activebackground="#ececec") self.addfacebtn.configure(activeforeground="#000000") self.addfacebtn.configure(background="#d9d9d9") self.addfacebtn.configure(disabledforeground="#a3a3a3") self.addfacebtn.configure(foreground="#000000") self.addfacebtn.configure(highlightbackground="#d9d9d9") self.addfacebtn.configure(highlightcolor="black") self.addfacebtn.configure(pady="0") self.addfacebtn.configure(command=self.addfacebtn_click, text='''Add Face''') self.showbtn1 = tk.Button(self.Frame5) self.showbtn1.place(relx=0.681, rely=0.138, height=33, width=86) self.showbtn1.configure(activebackground="#ececec") self.showbtn1.configure(activeforeground="#000000") self.showbtn1.configure(background="#d9d9d9") self.showbtn1.configure(disabledforeground="#a3a3a3") self.showbtn1.configure(foreground="#000000") self.showbtn1.configure(highlightbackground="#d9d9d9") self.showbtn1.configure(highlightcolor="black") self.showbtn1.configure(pady="0") self.showbtn1.configure(command=self.showbtn1_click, text='''Show All''') self.Label11 = tk.Label(top) self.Label11.place(relx=-0.008, rely=0.013, height=46, width=1262) self.Label11.configure(background="#d9d9d9") self.Label11.configure(disabledforeground="#a3a3a3") self.Label11.configure(font=font12) self.Label11.configure(foreground="#000000") self.Label11.configure(state='active') self.Label11.configure(text='''Employee Management System''')
def createWidgets(self): #Photo background self.panel = Label(self,bg='black') self.panel.grid(row=0, rowspan=7, column=0, padx=50) self.imgFile= Image.open('bg.gif') self.imgBackground = ImageTk.PhotoImage(self.imgFile) self.lbBackground = Label(self, image=self.imgBackground) self.lbBackground.grid(row=0, rowspan=6, column=0, columnspan=6) #Quit self.QUIT = Button(self, text="Quit", command=self.quit) self.QUIT.grid(row=5, column=5) #Browse file to de/en-crypt self.lbFileDir = Label(self, text="File:", bg='black', fg='white') self.lbFileDir.grid(row=0, column=1, sticky=E) self.etFileDir = Entry(self, width=40) self.etFileDir.grid(row=0, column=2, columnspan=3, sticky=W+E, padx=5) self.btFile = Button(self, text="Browse..", width=10, command=lambda: self.fileBrowse("file")) self.btFile.grid(row=0, column=5, pady=5) #Save to directory # self.lbSaveDir = Label(self, text="Save to folder:", bg='black', fg='white') # self.lbSaveDir.grid(row=2, column=1, sticky=E) # self.etSaveDir = Entry(self, width=50) # self.etSaveDir.grid(row=2, column=2, columnspan=2, sticky=W+E, padx=5) # self.btSaveDir = Button(self, text="Browse..", width=10, command=lambda: self.dirBrowse("save")) # self.btSaveDir.grid(row=2, column=4) #File content self.lbIn = Label(self, text="Text:", bg='black', fg='white') self.lbIn.grid(row=1, column=1, sticky=E) self.txIn = Text(self, height=5, width=75) self.txIn.grid(row=1, column=2, columnspan=4, padx=5) #Browse key file self.lbKey = Label(self, text="Key:", bg='black', fg='white') self.lbKey.grid(row=2, column=1, sticky=E) self.etKey = Entry(self) self.etKey.grid(row=2, column=2, columnspan=4, sticky=W+E, padx=5) # self.btKey = Button(self, text="Browse..", width=10, command=lambda: self.fileBrowse("key")) # self.btKey.grid(row=2, column=5) #Algorithm self.lbAlgorithm = Label(self, text="Algorithm:", bg='black', fg='white') self.lbAlgorithm.grid(row=3, column=1, sticky=E) self.cbAlgorithm = ttk.Combobox(self, state="readonly", width=15) algorithm = ("AES", "DES", "Ceasar", "Transposition") self.cbAlgorithm["value"] = algorithm self.cbAlgorithm.set("AES") self.cbAlgorithm.grid(row=3, column=2, sticky=W, padx=5, pady=5) #Encrypt/Decrypt self.lbEnDeCrypt = Label(self, text="Encrypt/Decrypt:", bg='black', fg='white') self.lbEnDeCrypt.grid(row=3, column=3, sticky=E) self.cbEnDeCrypt = ttk.Combobox(self, state="readonly", width=15) enDeCrypt = ("Encrypt", "Decrypt") self.cbEnDeCrypt["value"] = enDeCrypt self.cbEnDeCrypt.set("Encrypt") self.cbEnDeCrypt.grid(row=3, column=4, sticky=W, padx=5, pady=5) #Start button self.btStart = Button(self, text="Start", width=10, command= lambda: self.startThread()) self.btStart.grid(row=3, column=5) #Out self.lbOut = Label(self, text="Text:", bg='black', fg='white') self.lbOut.grid(row=4, column=1, sticky=E) self.txOut = Text(self, height=5, width=75) self.txOut.grid(row=4, column=2, columnspan=4, padx=5)
print 'DISPLAY INTERFACE' selected_star = None values = [] for i in range(0, len(cnts)): values.append(i+1) b, g, r = cv2.split(img) img = cv2.merge((r, g, b)) root = Tk(className = "Star Select") cboCombo = ttk.Combobox( root, values=values,state="readonly", textvariable="Select Star...") star_x, star_y, star_w, star_h = (None, None, None, None) def on_click(): global star_x, star_y, star_w, star_h selected_star_cnt = cnts[int(cboCombo.get())-1] # (i, c) touple [see below] print("Countours") print(selected_star_cnt) star_x, star_y, star_w, star_h = cv2.boundingRect(selected_star_cnt) print("starx, stary") print(star_x, star_y) root.destroy() print("Selected Star")
def __init__(self): """ Construct the main window interface """ super(Window, self).__init__() self.msg_selectproject = 'Select your project' self.msg_selectscene = 'Select an image of form name.####.exr' self.msg_selectshow = 'Select your SHOW' self.msg_selectSgtProject = 'Select your shotgun project to upload to' self.msg_selectSgtSequence = 'Now Select your shotgun sequence' self.msg_selectSgtShot = 'Now Select your shotgun shot' self.msg_selectSgtTask = 'Lastly Select your shotgun task' self.filefullpath = "" self.projfullpath = "" self.workspace = "" self.bgcolor0 = "light cyan" self.bgcolor1 = "white" self.bgcolor2 = "light grey" self.bgcolor3 = "pale green" self.master.configure(background=self.bgcolor1) self.user = os.getenv("USER") self.master.title("Proxy Generation Submit: {u}".format(u=self.user)) # ################ Options for buttons and canvas #################### self.button_opt = {'fill': Tkconstants.BOTH, 'padx': 5, 'pady': 5} self.label_opt = {'fill': Tkconstants.BOTH, 'padx': 5, 'pady': 5} self.canvas = tk.Canvas(self.master, height=200, width=300) self.canvas.pack(expand=True, fill=tk.BOTH) imagepath = os.path.join(os.path.dirname(dabtractor.__file__), "icons", "RV_logo_small.gif") imagetk = tk.PhotoImage(file=imagepath) # keep a link to the image to stop the image being garbage collected self.canvas.img = imagetk tk.Label(self.canvas, image=imagetk).grid(row=0, column=0, columnspan=4, sticky=tk.NW + tk.NE) __row = 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor3, text="Img Seq Proxy Generation").grid(row=__row, column=0, columnspan=5, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="$DABWORK").grid(row=__row, column=0, sticky=tk.E) self.dabworklab = tk.Label(self.canvas, text=self.job.dabwork, bg=self.bgcolor1, fg='black') self.dabworklab.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="$TYPE").grid(row=__row, column=0, sticky=tk.E) self.envtype = tk.StringVar() self.envtype.set("user_work") self.job.envtype = "user_work" self.envtypebox = ttk.Combobox(self.canvas, textvariable=self.envtype) self.envtypebox.config(values=["user_work", "project_work"], justify=tk.CENTER) self.envtypebox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) self.envtypebox.bind("<<ComboboxSelected>>", self.settype) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="$SHOW").grid(row=__row, column=0, sticky=tk.E) self.envshowbut = tk.Button(self.canvas, text=self.msg_selectshow, bg=self.bgcolor1, fg='black', command=self.setshow) self.envshowbut.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) self.setshow() __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="$PROJECT").grid(row=__row, column=0, sticky=tk.E) self.envproj = tk.StringVar() self.envprojbut = tk.Button(self.canvas, text=self.msg_selectproject, bg=self.bgcolor1, fg='black', command=self.setproject) self.envprojbut.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="$SCENE").grid(row=__row, column=0, sticky=tk.E) self.envscenebut = tk.Button(self.canvas, text=self.msg_selectscene, fg='black', command=self.setscene) self.envscenebut.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor3, text="Upload as new version to SHOTGUN").grid(row=__row, column=0, columnspan=4, rowspan=1, sticky=tk.W + tk.E) __row += 1 self.sgtProject = tk.StringVar() self.sgtSequence = tk.StringVar() self.sgtShot = tk.StringVar() self.sgtTask = tk.StringVar() # ################################################################### _txt = "Send the resulting proxy to Shotgun" self.sendToShotgun = tk.IntVar() self.sendToShotgun.set(1) self.job.sendToShotgun = True self.sendtoshotgunbut = ttk.Checkbutton(self.canvas, variable=self.sendToShotgun, command=self.setSendToShotgun) self.sendtoshotgunbut.config(text=_txt) self.sendtoshotgunbut.grid(row=__row, column=1, sticky=tk.W) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="SHOTGUN PROJ").grid(row=__row, column=0, sticky=tk.E) self.sgtProject.set(self.msg_selectSgtProject) self.sgtProjectBox = ttk.Combobox(self.canvas, textvariable=self.sgtProject) self.sgtProjectBox.config(values=self.getShotgunProjectValues(), justify=tk.CENTER) self.sgtProjectBox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) self.sgtProjectBox.bind("<<ComboboxSelected>>", self.setShotgunProject) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="SHOTGUN SEQ").grid(row=__row, column=0, sticky=tk.E) self.sgtSequence.set(self.msg_selectSgtSequence) self.sgtSequenceBox = ttk.Combobox(self.canvas, textvariable=self.sgtSequence) self.sgtSequenceBox.config(values=self.getShotgunSequenceValues(), justify=tk.CENTER) self.sgtSequenceBox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) self.sgtSequenceBox.bind("<<ComboboxSelected>>", self.setShotgunSequence) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="SHOTGUN SHOT").grid(row=__row, column=0, sticky=tk.E) self.sgtShot.set(self.msg_selectSgtShot) self.sgtShotBox = ttk.Combobox(self.canvas, textvariable=self.sgtShot) self.sgtShotBox.config(values=self.getShotgunShotValues(), justify=tk.CENTER) self.sgtShotBox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) self.sgtShotBox.bind("<<ComboboxSelected>>", self.setShotgunShot) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="SHOTGUN TASK").grid(row=__row, column=0, sticky=tk.E) self.sgtShot.set(self.msg_selectSgtShot) self.sgtTaskBox = ttk.Combobox(self.canvas, textvariable=self.sgtTask) self.sgtTaskBox.config(values=self.getShotgunTaskValues(), justify=tk.CENTER) self.sgtTaskBox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) self.sgtTaskBox.bind("<<ComboboxSelected>>", self.setShotgunTask) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor3, text="RVIO Generic Details").grid(row=__row, column=0, columnspan=4, rowspan=1, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="Department").grid(row=__row, column=0, sticky=tk.E) self.departmentlab = tk.Label(self.canvas, text=self.job.department, bg=self.bgcolor1, fg='black') self.departmentlab.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="Farm Tier").grid(row=__row, column=0, sticky=tk.E) self.tier = tk.StringVar() self.tier.set(self.job.env.config.getdefault("renderjob", "tier")) self.tierbox = ttk.Combobox(self.canvas, textvariable=self.tier) self.tierbox.config(values=self.job.env.config.getoptions( "renderjob", "tier"), justify=tk.CENTER) self.tierbox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="Force Start").grid(row=__row, column=0, sticky=tk.E) self.sf = tk.StringVar() self.sf.set("1") self.bar3 = tk.Entry(self.canvas, bg=self.bgcolor1, textvariable=self.sf, width=8).grid(row=__row, column=1, sticky=tk.W) tk.Label(self.canvas, bg=self.bgcolor1, text="Force End").grid(row=__row, column=3, sticky=tk.W) self.ef = tk.StringVar() self.ef.set("4") self.bar4 = tk.Entry(self.canvas, bg=self.bgcolor1, textvariable=self.ef, width=8).grid(row=__row, column=2, sticky=tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="By").grid(row=__row, column=0, sticky=tk.E) self.bf = tk.StringVar() self.bf.set("1") self.bar5 = tk.Entry(self.canvas, bg=self.bgcolor2, textvariable=self.bf, width=8).grid(row=__row, column=1, sticky=tk.W) __row += 1 tk.Label(self.canvas, bg=self.bgcolor1, text="Resolution").grid(row=__row, column=0, sticky=tk.E) self.resolution = tk.StringVar() self.resolution.set( self.job.env.config.getdefault("render", "resolution")) self.resolutionbox = ttk.Combobox(self.canvas, textvariable=self.resolution) self.resolutionbox.config(values=self.job.env.config.getoptions( "render", "resolution"), justify=tk.CENTER) self.resolutionbox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor3, text="JOB Specific Details").grid(row=__row, column=0, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="Render Threads").grid(row=__row, column=0, sticky=tk.E) self.threads = tk.StringVar() self.threads.set(self.job.env.config.getdefault("render", "threads")) self.threadsbox = ttk.Combobox(self.canvas, textvariable=self.threads) self.threadsbox.config(values=self.job.env.config.getoptions( "render", "threads"), justify=tk.CENTER) self.threadsbox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="Render Memory").grid(row=__row, column=0, sticky=tk.E) self.memory = tk.StringVar() self.memory.set(self.job.env.config.getdefault("render", "memory")) self.memorybox = ttk.Combobox(self.canvas, textvariable=self.memory) self.memorybox.config(values=self.job.env.config.getoptions( "render", "memory"), justify=tk.CENTER) self.memorybox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="Render Chunks").grid(row=__row, column=0, sticky=tk.E) self.chunks = tk.StringVar() self.chunks.set(self.job.env.config.getdefault("render", "chunks")) self.chunksbox = ttk.Combobox(self.canvas, textvariable=self.chunks) self.chunksbox.config(values=self.job.env.config.getoptions( "render", "chunks"), justify=tk.CENTER) self.chunksbox.grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### _txt = "Dont Write over existing Output - add date suffix" self.skipframes = tk.IntVar() self.skipframes.set(1) tk.Checkbutton(self.canvas, bg=self.bgcolor1, text=_txt, variable=self.skipframes).grid(row=__row, column=1, sticky=tk.W) __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor1, text="Other Options").grid(row=__row, column=0) self.options = tk.StringVar() self.options.set("") self.optionsbar = tk.Entry(self.canvas, bg=self.bgcolor2, textvariable=self.options, width=40).grid(row=__row, column=1, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### _txt = "Email Notifications" tk.Label(self.canvas, bg=self.bgcolor3, text=_txt).grid(row=__row, column=0, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### self.emailjobstart = tk.IntVar() self.emailjobstart.set(1) self.emailjobstartbut = tk.Checkbutton(self.canvas, variable=self.emailjobstart, bg=self.bgcolor1, text="Job Start").grid( row=__row, column=1, sticky=tk.W) self.emailjobend = tk.IntVar() self.emailjobend.set(1) self.emailjobendbut = tk.Checkbutton(self.canvas, variable=self.emailjobend, bg=self.bgcolor1, text="Job End").grid(row=__row, column=2, sticky=tk.W) __row += 1 # ################################################################### # self.emailtaskend = tk.IntVar() # self.emailtaskend.set(0) # self.emailtaskendbut=tk.Checkbutton(self.canvas, variable=self.emailtaskend, bg=self.bgcolor1, text="Each Frame End").grid(row=__row, column=1, sticky=tk.W) # __row += 1 # ################################################################### tk.Label(self.canvas, bg=self.bgcolor3, text="Submit Job To Tractor").grid(\ row=__row, column=0, columnspan=4, sticky=tk.W + tk.E) __row += 1 # ################################################################### # tk.Buttons self.cbutton = tk.Button(self.canvas, bg=self.bgcolor1, text='SUBMIT', command=lambda: self.submit()) self.cbutton.grid(row=__row, column=3, sticky=tk.W + tk.E) self.vbutton = tk.Button(self.canvas, bg=self.bgcolor1, text='VALIDATE', command=lambda: self.validate()) self.vbutton.grid(row=__row, column=1, columnspan=2, sticky=tk.W + tk.E) self.vbutton = tk.Button(self.canvas, bg=self.bgcolor1, text='CANCEL', command=lambda: self.cancel()) self.vbutton.grid(row=__row, column=0, sticky=tk.W + tk.E) self.master.mainloop()
def __init__(self): # Window # self.app = Tk() self.window = ttk.Frame(self.app, padding="10 5 10 8") Grid.rowconfigure(self.app, 0, weight=1) Grid.columnconfigure(self.app, 0, weight=1) self.window.grid(column=0, row=0, sticky=(N, W, E, S)) self.grid = ttk.Frame(self.window) self.grid.grid(column=1, row=1, columnspan=4, sticky=(N, W, E, S)) Grid.rowconfigure(self.window, 1, weight=1) Grid.columnconfigure(self.window, 1, weight=1) # Room Variables # self.channel = "PyChat/Default/" self.room = StringVar() self.room.set("default") self.current_room = StringVar() self.current_room.set(self.channel + self.room.get()) self.app.title("PyChat - Room: %s" % (self.room.get())) # Start Mosquitto # self.client = mqtt.Client() self.client.on_connect = self.on_connect self.client.on_message = self.on_message self.client.connect("test.mosquitto.org", 1883, 60) self.client.loop_start() # Chat Room Entry # ttk.Label(self.window, text="Room:").grid(column=1, row=1, sticky=E) self.room_entry = ttk.Entry(self.window, textvariable=self.room) self.room_entry.grid(column=2, row=1, columnspan=3, sticky=(W, E)) self.room_entry.bind("<Return>", self.set_room) self.roomButt = ttk.Button(self.window, text="Set Room", command=self.set_room) self.roomButt.grid(column=4, row=1, columnspan=2, sticky=(W, E)) # Message Window # self.mWindow = Listbox(self.window, height=10, width=30) self.mWindow.grid(column=1, row=2, columnspan=4, pady=5, sticky=(N, S, W, E)) self.scroll = ttk.Scrollbar(self.window, orient=VERTICAL, command=self.mWindow.yview) self.scroll.grid(column=5, row=2, pady=5, sticky=(N, S, W)) self.mWindow['yscrollcommand'] = self.scroll.set # Message Entry # self.message = StringVar() self.message_entry = ttk.Entry(self.window, textvariable=self.message) self.message_entry.grid(column=1, row=3, columnspan=3, sticky=(W, E)) self.message_entry.bind("<Return>", self.send) self.sendButt = ttk.Button(self.window, text="Send", command=self.send) self.sendButt.grid(column=4, row=3, columnspan=2, sticky=(W, E)) ttk.Separator(self.window, orient=HORIZONTAL).grid(column=1, row=4, columnspan=5, pady=10, sticky=(W, E)) # Name Entry # self.name = StringVar() ttk.Label(self.window, text="Name:", width=5).grid(column=1, row=5, sticky=E) self.name_entry = ttk.Entry(self.window, textvariable=self.name) self.name_entry.grid(column=2, row=5, sticky=(W, E)) # Color Selection # self.colorvar = StringVar() ttk.Label(self.window, text="Color:").grid(column=3, row=5, sticky=E) self.color = ttk.Combobox(self.window, width=7, textvariable=self.colorvar, state='readonly') self.color['values'] = ('Black', 'Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Purple', 'Brown') self.color.grid(column=4, row=5, sticky=(W, E)) self.color.set("Black") self.colorDic = {'Black': 'black', 'Red': 'crimson', 'Orange': 'darkorange', 'Yellow': 'gold', 'Green': 'olivedrab', 'Blue': 'mediumblue', 'Purple': 'darkmagenta', 'Brown': 'saddlebrown'} # Create Menu # self.menu_bar = Menu(self.app) self.file_menu = Menu(self.menu_bar) self.file_menu.add_command(label='Open README', command=self.readme) self.file_menu.add_command(label='About', command=self.about) self.file_menu.add_separator() self.file_menu.add_command(label='Quit', command=self.app.destroy) self.menu_bar.add_cascade(label='File', menu=self.file_menu) self.helpmenu = Menu(self.menu_bar) self.helpmenu.add_command(label='Open README', command=self.readme) self.menu_bar.add_cascade(label='Help', menu=self.helpmenu) self.app.config(menu=self.menu_bar) # Resize Window # self.app.minsize(width=400, height=300) self.app.maxsize(width=700, height=500) for x in range(1, 5): Grid.columnconfigure(self.window, x, weight=1) for y in range(2, 3): Grid.rowconfigure(self.window, y, weight=1) # App Loop # self.app.mainloop()
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' font13 = "-family {DejaVu Sans} -size 10 -weight bold -slant " \ "roman -underline 0 -overstrike 0" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("1440x846+1440+0") top.title("New Toplevel") top.configure(highlightcolor="black") self.style.configure('TNotebook.Tab', background=_bgcolor) self.style.configure('TNotebook.Tab', foreground=_fgcolor) self.style.map('TNotebook.Tab', background=[('selected', _compcolor), ('active', _ana2color)]) self.TNotebook1 = ttk.Notebook(top) self.TNotebook1.place(relx=0.05, rely=0.04, relheight=0.94, relwidth=0.92) self.TNotebook1.configure(width=1322) self.TNotebook1.configure(takefocus="") self.TNotebook1_t0 = Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t0, padding=3) self.TNotebook1.tab( 0, text="Roll Call", compound="left", underline="-1", ) self.TNotebook1_t0.configure(width=1350) self.TNotebook1_t1 = Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t1, padding=3) self.TNotebook1.tab( 1, text="Exam Mode", compound="left", underline="-1", ) self.Frame1 = Frame(self.TNotebook1_t0) self.Frame1.place(relx=0.07, rely=0.13, relheight=0.84, relwidth=0.88) self.Frame1.configure(relief=GROOVE) self.Frame1.configure(borderwidth="2") self.Frame1.configure(relief=GROOVE) self.Frame1.configure(background="#e2ffe0") self.Frame1.configure(highlightbackground="#4f4f4f") self.Frame1.configure(width=1165) self.Button4 = Button(self.Frame1) self.Button4.place(relx=0.01, rely=0.02, height=65, width=175) self.Button4.configure(activebackground="#d9d9d9") self.Button4.configure(background="#ffffd6") self.Button4.configure(text='''Button''') self.Button4.configure(width=117) self.Button4_1 = Button(self.Frame1) self.Button4_1.place(relx=0.01, rely=0.12, height=65, width=175) self.Button4_1.configure(activebackground="#d9d9d9") self.Button4_1.configure(background="#ffffd6") self.Button4_1.configure(text='''Button''') self.Button4_2 = Button(self.Frame1) self.Button4_2.place(relx=0.01, rely=0.23, height=65, width=175) self.Button4_2.configure(activebackground="#d9d9d9") self.Button4_2.configure(background="#ffffd6") self.Button4_2.configure(text='''Button''') self.Button4_2 = Button(self.Frame1) self.Button4_2.place(relx=0.01, rely=0.34, height=65, width=175) self.Button4_2.configure(activebackground="#d9d9d9") self.Button4_2.configure(background="#ffffd6") self.Button4_2.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.01, rely=0.45, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.01, rely=0.56, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.01, rely=0.67, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.01, rely=0.78, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.01, rely=0.88, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.16, rely=0.02, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.16, rely=0.12, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.16, rely=0.23, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.16, rely=0.34, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.16, rely=0.45, height=65, width=175) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(background="#ffffd6") self.Button4_3.configure(text='''Button''') self.Button4_3 = Button(self.Frame1) self.Button4_3.place(relx=0.0, rely=0.0, height=1, width=1) self.Button4_3.configure(activebackground="#d9d9d9") self.Button4_3.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.16, rely=0.56, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4.configure(width=117) self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.16, rely=0.67, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.16, rely=0.78, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4.configure(width=117) self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.16, rely=0.88, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.02, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.12, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.23, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.34, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.45, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.56, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.67, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.78, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.35, rely=0.88, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.02, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.12, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.23, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.34, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.45, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.56, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.67, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.78, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.51, rely=0.88, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.02, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.02, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.12, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.23, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.34, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.45, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.56, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.67, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.78, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.69, rely=0.88, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.12, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.23, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.34, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.45, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.56, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.67, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.78, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.Button4_4 = Button(self.Frame1) self.Button4_4.place(relx=0.84, rely=0.88, height=65, width=175) self.Button4_4.configure(activebackground="#d9d9d9") self.Button4_4.configure(background="#ffffd6") self.Button4_4.configure(text='''Button''') self.tNo40_t0_but41 = Button(self.TNotebook1_t0) self.tNo40_t0_but41.place(relx=0.54, rely=0.04, height=46, width=120) self.tNo40_t0_but41.configure(activebackground="#d9d9d9") self.tNo40_t0_but41.configure(text='''Edit Student list''') self.tNo40_t0_but41.configure(width=97) self.Button1_5 = Button(self.TNotebook1_t0) self.Button1_5.place(relx=0.65, rely=0.04, height=46, width=107) self.Button1_5.configure(activebackground="#d9d9d9") self.Button1_5.configure(text='''Student Info''') self.Button1_6 = Button(self.TNotebook1_t0) self.Button1_6.place(relx=0.86, rely=0.04, height=46, width=110) self.Button1_6.configure(activebackground="#fdffbd") self.Button1_6.configure(activeforeground="#ffa1a1") self.Button1_6.configure(background="#ffa1a1") self.Button1_6.configure(font=font13) self.Button1_6.configure(foreground="#fdffbd") self.Button1_6.configure(text='''Re - Roll Call''') self.Button1_6 = Button(self.TNotebook1_t0) self.Button1_6.place(relx=0.76, rely=0.04, height=46, width=107) self.Button1_6.configure(activebackground="#d9d9d9") self.Button1_6.configure(text='''Absent List''') self.TCombobox1 = ttk.Combobox(self.TNotebook1_t0) self.TCombobox1.place(relx=0.07, rely=0.05, relheight=0.02, relwidth=0.45) self.TCombobox1.configure(textvariable=project_support.combobox) self.TCombobox1.configure(width=597) self.TCombobox1.configure(background="#000000") self.TCombobox1.configure(takefocus="") self.menubar = Menu(top, font="TkMenuFont", bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar)
def __init__(self, top=None): """This class configures and populates the toplevel window. top is the toplevel containing window.""" _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana1color)]) top.geometry("600x420+393+178") top.title("Cheetah Configure") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") top.resizable(0, 0) self.TLabel1 = ttk.Label(top) self.TLabel1.place(relx=0.03, rely=0.05, height=24, width=57) self.TLabel1.configure(background="#d9d9d9") self.TLabel1.configure(foreground="#000000") self.TLabel1.configure(font="TkDefaultFont") self.TLabel1.configure(relief=FLAT) self.TLabel1.configure(text='''Method :''') self.TCombobox1 = ttk.Combobox(top) self.TCombobox1.place(relx=0.13, rely=0.05, relheight=0.06, relwidth=0.11) self.value_list = ["post", "get"] self.TCombobox1.configure(values=self.value_list) self.TCombobox1.configure(state="readonly") self.TCombobox1.configure(textvariable=cheetah_config_support.method) self.TCombobox1.configure(takefocus="") self.TLabel2 = ttk.Label(top) self.TLabel2.place(relx=0.27, rely=0.05, height=24, width=48) self.TLabel2.configure(background="#d9d9d9") self.TLabel2.configure(foreground="#000000") self.TLabel2.configure(font="TkDefaultFont") self.TLabel2.configure(relief=FLAT) self.TLabel2.configure(text='''Server :''') self.TCombobox2 = ttk.Combobox(top) self.TCombobox2.place(relx=0.35, rely=0.05, relheight=0.06, relwidth=0.12) self.value_list = [ "detect", "apache", "nginx", "iis", ] self.TCombobox2.configure(values=self.value_list) self.TCombobox2.configure(state="readonly") self.TCombobox2.configure(textvariable=cheetah_config_support.server) self.TCombobox2.configure(takefocus="") self.TLabel3 = ttk.Label(top) self.TLabel3.place(relx=0.5, rely=0.05, height=24, width=39) self.TLabel3.configure(background="#d9d9d9") self.TLabel3.configure(foreground="#000000") self.TLabel3.configure(font="TkDefaultFont") self.TLabel3.configure(relief=FLAT) self.TLabel3.configure(text='''Type :''') self.TCombobox3 = ttk.Combobox(top) self.TCombobox3.place(relx=0.57, rely=0.05, relheight=0.06, relwidth=0.12) self.value_list = [ "detect", "php", "jsp", "asp", "aspx", ] self.TCombobox3.configure(values=self.value_list) self.TCombobox3.configure(state="readonly") self.TCombobox3.configure( textvariable=cheetah_config_support.shelltype) self.TCombobox3.configure(takefocus="") self.TLabel4 = ttk.Label(top) self.TLabel4.place(relx=0.72, rely=0.05, height=24, width=71) self.TLabel4.configure(background="#d9d9d9") self.TLabel4.configure(foreground="#000000") self.TLabel4.configure(font="TkDefaultFont") self.TLabel4.configure(relief=FLAT) self.TLabel4.configure(text='''Parameter :''') self.TCombobox4 = ttk.Combobox(top) self.TCombobox4.place(relx=0.84, rely=0.05, relheight=0.06, relwidth=0.12) self.value_list = [ "1000", ] self.TCombobox4.configure(values=self.value_list) self.TCombobox4.configure( textvariable=cheetah_config_support.parameter) self.TCombobox4.configure(takefocus="") self.TLabel5 = ttk.Label(top) self.TLabel5.place(relx=0.03, rely=0.17, height=21, width=97) self.TLabel5.configure(background="#d9d9d9") self.TLabel5.configure(foreground="#000000") self.TLabel5.configure(font="TkDefaultFont") self.TLabel5.configure(relief=FLAT) self.TLabel5.configure(text='''Thread number:''') self.Spinbox1 = Spinbox(top, from_=1.0, to=100.0) self.Spinbox1.place(relx=0.2, rely=0.17, relheight=0.05, relwidth=0.12) self.Spinbox1.configure(activebackground="#f9f9f9") self.Spinbox1.configure(background="white") self.Spinbox1.configure(buttonbackground="#d9d9d9") self.Spinbox1.configure(disabledforeground="#a3a3a3") self.Spinbox1.configure(foreground="black") self.Spinbox1.configure(from_="1.0") self.Spinbox1.configure(increment="1.0") self.Spinbox1.configure(highlightbackground="black") self.Spinbox1.configure(highlightcolor="black") self.Spinbox1.configure(insertbackground="black") self.Spinbox1.configure(selectbackground="#c4c4c4") self.Spinbox1.configure(selectforeground="black") self.Spinbox1.configure(state="disable") self.Spinbox1.configure(textvariable=cheetah_config_support.thread_num) self.Spinbox1.configure(to="100.0") self.TLabel6 = ttk.Label(top) self.TLabel6.place(relx=0.35, rely=0.17, height=21, width=93) self.TLabel6.configure(background="#d9d9d9") self.TLabel6.configure(foreground="#000000") self.TLabel6.configure(font="TkDefaultFont") self.TLabel6.configure(relief=FLAT) self.TLabel6.configure(text='''Request delay :''') self.Spinbox2 = Spinbox(top, from_=0.0, to=60.0) self.Spinbox2.place(relx=0.52, rely=0.17, relheight=0.05, relwidth=0.12) self.Spinbox2.configure(activebackground="#f9f9f9") self.Spinbox2.configure(background="white") self.Spinbox2.configure(buttonbackground="#d9d9d9") self.Spinbox2.configure(disabledforeground="#a3a3a3") self.Spinbox2.configure(foreground="black") self.Spinbox2.configure(from_="0.0") self.Spinbox2.configure(increment="0.5") self.Spinbox2.configure(highlightbackground="black") self.Spinbox2.configure(highlightcolor="black") self.Spinbox2.configure(insertbackground="black") self.Spinbox2.configure(selectbackground="#c4c4c4") self.Spinbox2.configure(selectforeground="black") self.Spinbox2.configure(textvariable=cheetah_config_support.req_delay) self.Spinbox2.configure(to="60.0") # self.Spinbox2.configure(value="0.0") # print(self.Spinbox2.get()) self.TLabel7 = ttk.Label(top) self.TLabel7.place(relx=0.65, rely=0.17, height=21, width=106) self.TLabel7.configure(background="#d9d9d9") self.TLabel7.configure(foreground="#000000") self.TLabel7.configure(font="TkDefaultFont") self.TLabel7.configure(relief=FLAT) self.TLabel7.configure(text='''Request timeout :''') self.Spinbox3 = Spinbox(top, from_=10.0, to=60.0) self.Spinbox3.place(relx=0.84, rely=0.17, relheight=0.05, relwidth=0.12) self.Spinbox3.configure(activebackground="#f9f9f9") self.Spinbox3.configure(background="white") self.Spinbox3.configure(buttonbackground="#d9d9d9") self.Spinbox3.configure(disabledforeground="#a3a3a3") self.Spinbox3.configure(foreground="black") self.Spinbox3.configure(from_="10.0") self.Spinbox3.configure(increment="0.5") self.Spinbox3.configure(highlightbackground="black") self.Spinbox3.configure(highlightcolor="black") self.Spinbox3.configure(insertbackground="black") self.Spinbox3.configure(selectbackground="#c4c4c4") self.Spinbox3.configure(selectforeground="black") self.Spinbox3.configure(textvariable=cheetah_config_support.time_out) self.Spinbox3.configure(to="60.0") self.TLabel8 = ttk.Label(top) self.TLabel8.place(relx=0.03, rely=0.29, height=21, width=119) self.TLabel8.configure(background="#d9d9d9") self.TLabel8.configure(foreground="#000000") self.TLabel8.configure(font="TkDefaultFont") self.TLabel8.configure(relief=FLAT) self.TLabel8.configure(text='''Forge HTTP Header''') self.style.map('TCheckbutton', background=[('selected', _bgcolor), ('active', _ana1color)]) self.TCheckbutton1 = ttk.Checkbutton(top) self.TCheckbutton1.place(relx=0.1, rely=0.36, relwidth=0.24, relheight=0.0, height=23) # self.TCheckbutton1.bind("<ButtonRelease-1>", cheetah_config_support.save_random_ua) self.TCheckbutton1.configure( command=cheetah_config_support.save_config) self.TCheckbutton1.configure(variable=cheetah_config_support.random_ua) self.TCheckbutton1.configure(takefocus="") self.TCheckbutton1.configure(text='''Random User-Agent''') self.TCheckbutton2 = ttk.Checkbutton(top) self.TCheckbutton2.place(relx=0.42, rely=0.36, relwidth=0.21, relheight=0.0, height=23) self.TCheckbutton2.configure( command=cheetah_config_support.save_config) self.TCheckbutton2.configure(variable=cheetah_config_support.con_close) self.TCheckbutton2.configure(takefocus="") self.TCheckbutton2.configure(text='''Connection: close''') self.TCheckbutton3 = ttk.Checkbutton(top) self.TCheckbutton3.place(relx=0.72, rely=0.36, relwidth=0.17, relheight=0.0, height=23) self.TCheckbutton3.configure( command=cheetah_config_support.save_config) self.TCheckbutton3.configure( variable=cheetah_config_support.keep_alive) self.TCheckbutton3.configure(takefocus="") self.TCheckbutton3.configure(text='''Keep-Alive: 0''') self.TCheckbutton4 = ttk.Checkbutton(top) self.TCheckbutton4.place(relx=0.1, rely=0.45, relwidth=0.27, relheight=0.0, height=23) # self.TCheckbutton4.configure(command=cheetah_config_support.save_config) self.TCheckbutton4.configure( command=cheetah_config_support.custom_req_hdr) self.TCheckbutton4.configure( variable=cheetah_config_support.custom_hdr) self.TCheckbutton4.configure(takefocus="") self.TCheckbutton4.configure(text='''Custom request header''') self.Text1 = Text(top) self.Text1.place(relx=0.1, rely=0.55, relheight=0.31, relwidth=0.79) self.Text1.configure(background="white") self.Text1.configure(font="TkTextFont") self.Text1.configure(foreground="black") self.Text1.configure(highlightbackground="#d9d9d9") self.Text1.configure(highlightcolor="black") self.Text1.configure(insertbackground="black") self.Text1.configure(selectbackground="#c4c4c4") self.Text1.configure(selectforeground="black") self.Text1.configure(width=474) # self.Text1.delete(0, END) self.Text1.insert('1.0', cheetah_config_support.custom_hdr_data.get()) self.Text1.configure(state="disabled") self.Text1.bind('<KeyRelease>', cheetah_config_support.compare_hdr_data) self.TButton1 = ttk.Button(top) self.TButton1.place(relx=0.34, rely=0.9, height=27, width=87) self.TButton1.configure( command=cheetah_config_support.exit_config_setting) self.TButton1.configure(takefocus="") self.TButton1.configure(text='''OK''') self.TButton2 = ttk.Button(top) self.TButton2.place(relx=0.52, rely=0.9, height=27, width=87) self.TButton2.configure( command=cheetah_config_support.exit_config_setting) self.TButton2.configure(takefocus="") self.TButton2.configure(text='''Cancel''')
def update(self, event=None): if not event: widget = None else: widget = event.widget tally_id = self.meshTallies[self.tallyBox.current()] selectedTally = self.datafile.tallies[tally_id] # Get mesh for selected tally self.mesh = self.datafile.meshes[selectedTally.filters['mesh'].bins[0] - 1] # Get mesh dimensions self.nx, self.ny, self.nz = self.mesh.dimension # Repopulate comboboxes baesd on current basis selection text = self.basisBox['values'][self.basisBox.current()] if text == 'xy': self.axialBox['values'] = [str(i + 1) for i in range(self.nz)] elif text == 'yz': self.axialBox['values'] = [str(i + 1) for i in range(self.nx)] else: self.axialBox['values'] = [str(i + 1) for i in range(self.ny)] self.axialBox.current(0) # If update() was called by a change in the basis combobox, we don't # need to repopulate the filters if widget == self.basisBox: self.redraw() return # Update scores self.scoreBox['values'] = selectedTally.scores self.scoreBox.current(0) # Remove any filter labels/comboboxes that exist for row in range(6, self.selectFrame.grid_size()[1]): for w in self.selectFrame.grid_slaves(row=row): w.grid_forget() w.destroy() # create a label/combobox for each filter in selected tally count = 0 for filterType in selectedTally.filters: if filterType == 'mesh': continue count += 1 # Create label and combobox for this filter label = tk.Label(self.selectFrame, text=self.labels[filterType]) label.grid(row=count + 6, column=0, sticky=tk.W) combobox = ttk.Combobox(self.selectFrame, state='readonly') self.filterBoxes[filterType] = combobox # Set combobox items f = selectedTally.filters[filterType] if filterType in ['energyin', 'energyout']: combobox['values'] = [ '{0} to {1}'.format(*f.bins[i:i + 2]) for i in range(f.length) ] else: combobox['values'] = [str(i) for i in f.bins] combobox.current(0) combobox.grid(row=count + 6, column=1, sticky=tk.W + tk.E) combobox.bind('<<ComboboxSelected>>', self.redraw) # If There are no filters, leave a 'None available' message if count == 0: count += 1 label = tk.Label(self.selectFrame, text="None Available") label.grid(row=count + 6, column=0, sticky=tk.W) self.redraw()