def config_label(self, lab): lab['font'] = Font(root=self.master, family='Helvetica', size=18) lab['width'] = 10 lab['height'] = 2 self.config_bg(lab) self.config_fg(lab)
def config_optionMenu(self, mnu): mnu['font'] = Font(root=self.master, family='Helvetica', size=18) mnu['width'] = 10 mnu['height'] = 2 mnu['activebackground'] = self.default_bg mnu['activeforeground'] = self.default_fg mnu['bd'] = 0 mnu['highlightthickness'] = 1 mnu['relief'] = 'ridge' mnu['menu'].config( font=Font(root=self.master, family='Helvetica', size=18)) mnu['menu'].config(activebackground=self.default_bg) mnu['menu'].config(activeforeground=self.default_fg) self.config_bg(mnu) self.config_fg(mnu)
def config_btn(self, btn): btn['font'] = Font(root=self.master, family='Helvetica', size=18) btn['width'] = 8 btn['height'] = 2 btn['activebackground'] = self.default_bg btn['activeforeground'] = self.default_fg btn['bd'] = 0 btn['highlightthickness'] = 1 btn['relief'] = 'ridge' self.config_bg(btn) self.config_fg(btn)
ser = serial.Serial( 'COM7', 9600 ) #Check which port your device is connected to and change it accordingly. width, height = 400, 400 #Dimensions of the canvas. len1, len2 = 0.85, 0.3 #Dimensions of the needle, relative to the canvas ray. ray = int(0.7 * width / 2) #Radius of the dial. x0, y0 = width / 2, width / 2 #Position of the center of the circle. min_speed, max_speed = 0, 220 #Max and min values on the dial. Adjust according to need. step_speed = 20 #Least count or smallest division on the dial which has a text value displayed. Adjust according to need. min_rpm, max_rpm = 0, 8 #Max and min values on the dial. Adjust according to need. step_rpm = 1 #Least count or smallest division on the dial which has a text value displayed. Adjust according to need. root = Tk() meter_font = Font( family="Tahoma", size=12, weight='normal') #The font used in the meter. Feel free to play around. temp = ser.readline( ) #Take the first reading as a temp/garbage value so that it doesn't mess up the program. #Set the titles of the window, dials etc. def setTitles(): root.title('Zuura') speed.itemconfig(speed.title, text='Speed') speed.itemconfig(speed.unit, text='KMPH') rpm.itemconfig(rpm.title, text='RPM') rpm.itemconfig(rpm.unit, text='x1000') class Meter(Canvas):
def __init__(self, gui_input: Queue, gui_output: Queue, title: str, root=None): # Set initial state and the title of the GUI. self.root = root or Tk() self.root.title(title) # Set the size of the GUI to a fixed size. self.root.resizable(False, False) self.quit_state = False self.line = '' self.nickname = "" self.created_room = False self.pressed_refresh = False self.selected_server = -2 self.gui_input_queue = gui_input self.gui_output_queue = gui_output # Create frames, which are different windows in GUI. self.f1 = Frame(root) self.f2 = Frame(root) self.f3 = Frame(root) self.f4 = Frame(root) normal_font = Font(family='Calibris', size=12) # Initialize the frames. self.frames = [self.f1, self.f2, self.f3, self.f4] for frame in self.frames: frame.grid(row=0, column=0, sticky='news') self.current_frame = self.f1 # Create textboxes to set the name of the user label_1 = Label(self.f1, text="Select a room and create a nickname") label_1.config(font=('Calibris', 16)) label_1.pack() self.e = Entry(self.f1) self.e.configure(font=normal_font) self.e.focus_set() self.e.pack() self.btn_refresh = Button(self.f1, text='Refresh', command=self.refresh) self.btn_refresh.config(height=4, width=20) self.btn_refresh.pack(side=BOTTOM) # Make a textbox with scrollbar. scrolly = Scrollbar(self.f2) scrolly.pack(side=RIGHT, fill=Y) self.txt_log = Text(self.f2) # Change size of the GUI here. self.txt_log.config(width=70, height=30) self.txt_log.config(state='disabled') self.txt_log.configure(font=normal_font) self.txt_log.pack(fill=BOTH) scrolly.config(command=self.txt_log.yview) self.txt_log.config(yscrollcommand=scrolly.set) # Make buttons for shortcuts. self.prompt = Entry(self.f2) self.prompt.configure(font=normal_font) self.prompt.pack(expand=1, fill=X) btn_ok = Button(self.f2, text='Ok', command=self.submit) btn_clear = Button(self.f2, text='Clear', command=self.clear) btn_quit = Button(self.f2, text='Quit', fg='red', command=self.quit) btn_back = Button(self.f2, text='Back', command=self.back) btn_ok.pack(side=RIGHT) btn_clear.pack(side=RIGHT) btn_quit.pack(side=LEFT) btn_back.pack(side=LEFT) # Assign key shortcuts. self.root.bind('<Return>', lambda e, b=btn_ok: b.invoke(), add="+") self.root.bind('<Escape>', lambda e, b=btn_quit: b.invoke()) # Create buttons to go to the next frame. self.x = Button(self.f1, text='Go to chat', state=DISABLED, command=self.join_chat) self.x.pack() # Assign more key binds self.root.bind('<Return>', lambda e, b=self.x: b.invoke(), add="+") self.raise_frame(self.f1)
print("\t| Documentation specialist:\tBeatrice A. Abesamis |") print("\t==================================================================\n") root = Tk() root.wm_title("Numerical Methods (Bisection Method)") root.overrideredirect(1) # COLOR THEME main_bg = "#FFFFFF" #main_bg = "#FFFF80" # END COLOR THEME # Window Properties k = (root.winfo_screenwidth() / 2) - (1000 / 2) root.config(height=649, width=1000, bg=main_bg) root.geometry("1000x649+{}+50".format(int(k))) o_font = Font(family="Segoe UI", size=11) console = Text(root, width=70, height=22, font=o_font, bg=main_bg, relief=FLAT) console.place(x=10, y=201) lbl_bisection = Label(root, text="BISECTION METHOD", bg="#FFFF00", font="-weight bold") lbl_bisection.place(x=10, y=10) # Graph Properties matplotlib.get_backend() f = Figure(figsize=(5, 7.6), dpi=80) a = f.add_subplot(211) b = f.add_subplot(212)
def set_libs(lang): root.title(_['title'][lang]) menu.entryconfig(1, label=_['exo'][lang]) menu.entryconfig(2, label=_['opts'][lang]) speed.itemconfig(speed.title, text=_['speed'][lang]) speed.itemconfig(speed.unit, text=_['cpm'][lang]) errors.itemconfig(errors.title, text=_['err'][lang]) errors.itemconfig(errors.unit, text='%') for i, entry in enumerate(['open', 'paste', 'clear', 'restart']): file_menu.entryconfig(i, label=_[entry][lang]) root = Tk() font = Font(family="Courier New", size=12, weight='bold') # text font meter_font = Font(family="Arial", size=12, weight='normal') result_box = None exo = None t0 = None class Exercise: def __init__(self, text=""): self.text = text model.delete(1.0, END) model.insert(END, self.text) def reset(self): self.start = None
# parameters #ser=serial.Serial('COM7',9600) #Check which port your device is connected to and change it accordingly. width, height = 400, 400 #Dimensions of the canvas. len1, len2 = 0.85, 0.3 #Dimensions of the needle, relative to the canvas ray. ray = int(0.7 * width / 2) #Radius of the dial. rayR = int(0.5 * width / 2) x0, y0 = width / 2, width / 2 #Position of the center of the circle. min_speed, max_speed = 0, 260 #Max and min values on the dial. Adjust according to need. step_speed = 20 #Least count or smallest division on the dial which has a text value displayed. Adjust according to need. min_rpm, max_rpm = 0, 10 #Max and min values on the dial. Adjust according to need. step_rpm = 1 #Least count or smallest division on the dial which has a text value displayed. Adjust according to need. root = Tk() meter_font = Font( family="DS-Digital", size=18, weight='normal') #The font used in the meter. Feel free to play around. #temp=ser.readline()#Take the first reading as a temp/garbage value so that it doesn't mess up the program. #Set the titles of the window, dials etc. def setTitles(): root.title('Zuura') #speed.itemconfig(speed.title,text='Speed') speed.itemconfig(speed.unit, text='KMPH') #rpm.itemconfig(rpm.title,text='RPM') rpm.itemconfig(rpm.unit, text='x1000') class Meter(Canvas):