def CORE(S,M,f,port="z11",RS=0,RL=oo): Bode(fraction(f)[0], fraction(f)[1],port,fraction(f)[0],fraction(f)[1]) if S==0: caer1(f,port=port,RS=RS,RL=RL) elif S==M: caer2(f,port=port,RS=RS,RL=RL) else: bias={"type":"w","label":"unkw","dirrection":"right","parallel":False} print("solution one for",f) Append("solution one for "+str(f)) s1=caer1(f,repeat=abs(S-M)) s2=caer2(s1[2],gener=s1[1],repeat=S) s1[0].append(bias) for i in s2[0]: s1[0].append(i) #draw(s1[0],port,RS,RL) Append(40*"- ") ans1=s1[0] print("\n","solution two for",f) Append("solution two for "+str(f)) s2=caer2(f,repeat=S) s1=caer1(s2[2],gener=s2[1],repeat=abs(S-M)) s2[0].append(bias) for i in s1[0]: s2[0].append(i) Append("",finish=True) #draw(s2[0],port=port,rs=RS,rl=RL) window =ThemedTk(theme="adapta") window.title('Please choose to plot') window.rowconfigure([0,1], weight=1) window.columnconfigure([0], weight=1) label = ttk.Label(window,text='For any solution you can draw a schematic',anchor=tk.CENTER) label.grid(row=0,column=0,sticky=tk.N+tk.S+tk.E+tk.W) card_frame = ttk.Frame(window) card_frame.grid(row=1, column=0, sticky=tk.N+tk.S+tk.E+tk.W) card_frame.rowconfigure([0], weight=1) card_frame.columnconfigure([0,1], weight=1) solution1 = ttk.Button(card_frame,text="plot solution one",width=15, command=lambda: draw(ans1,port,RS,RL)) solution1.grid(row=0, column=0, sticky=tk.N+tk.S+tk.E+tk.W) solution2 = ttk.Button(card_frame,text="plot solution two",width=15, command=lambda: draw(s2[0],port,RS,RL)) solution2.grid(row=0, column=1, sticky=tk.N+tk.S+tk.E+tk.W) window.resizable(width=False, height=False) window.deiconify() window.mainloop()
def main(): global LARGE_FONT, realpositive, port LARGE_FONT = ("Verdana", 12) x, y = 648, 520 #root = tk.Tk() root = ThemedTk(theme="adapta") realpositive = tk.IntVar() port = tk.StringVar() global startpage, synthesis, darlington, pageThree, transferFunction startpage = tk.Frame(root) synthesis = tk.Frame(root) darlington = tk.Frame(root) pageThree = tk.Frame(root) transferFunction = tk.Frame(root) for frame in (startpage, synthesis, darlington, pageThree, transferFunction): frame.grid(row=0, column=0, sticky='news') StartPage() Synthesisframe() Darlingtonframe() PageThreeframe() TransferFunctionframe() root.update_idletasks() # Update "requested size" from geometry manager a, a0 = str(x), x / 2 b, b0 = str(y), y / 2 root.geometry("+%d+%d" % ((root.winfo_screenwidth() / 2) - a0, (root.winfo_screenheight() / 3) - b0)) root.deiconify() root.resizable(width=False, height=False) menubar = tk.Menu(root) filemenu = tk.Menu(menubar, tearoff=0) filemenu.add_command(label="Tutorial", command=toturial) filemenu.add_command(label="About", command=About) filemenu.add_command(label="Exit", command=root.destroy) menubar.add_cascade(label="MENU", menu=filemenu) root.config(menu=menubar) root.title("LC & RC Filter") root.bind('<Escape>', lambda e: root.destroy()) root.protocol("WM_DELETE_WINDOW", root.iconify) raise_frame(startpage) root.mainloop()
def main(): global message message = "" if "alarm.mp3" not in os.listdir("."): print("alarm.mp3 not found please check it out") time.sleep(5) raise Exception("alarm.mp3 not found please check it out") LARGE_FONT = ("Verdana", 12) root = ThemedTk(theme="adapta") root.title('HOTSPOT') root.bind('<Escape>', lambda e: root.destroy()) root.protocol("WM_DELETE_WINDOW", root.iconify) root.update_idletasks() try: root.iconbitmap('icon.ico') except: pass home = ttk.Frame(root) home.grid(row=0, column=0, sticky='news') home.rowconfigure([0], weight=1) home.columnconfigure([0, 1], weight=1) server = ttk.Frame(root) server.grid(row=0, column=0, sticky='news') server.rowconfigure([0, 1, 2, 3], weight=1) server.columnconfigure([0], weight=1) status5 = ttk.Label(server, text="", font=LARGE_FONT, anchor=tk.CENTER) status5.grid(row=2, column=0, sticky=tk.N + tk.S + tk.E + tk.W) status7 = ttk.Label(server, text="", font=LARGE_FONT, anchor=tk.CENTER) status7.grid(row=1, column=0, sticky=tk.N + tk.S + tk.E + tk.W) progress2 = ttk.Progressbar(server, orient="horizontal", mode="determinate", cursor='spider') progress2.grid(row=3, column=0, sticky=tk.N + tk.S + tk.E + tk.W) progress2["maximum"] = 100 button3 = ttk.Button(server, text="Start", width=15, command=lambda: Thread(target=lambda: makeserver( status7, progress2, server)).start()) button3.grid(row=1, column=2, sticky=tk.N + tk.S + tk.E + tk.W) button3 = ttk.Button(home, text="Recieve", width=15, command=lambda: raise_frame(server, "R", status5)) button3.grid(row=0, column=0, sticky=tk.N + tk.S + tk.E + tk.W) button4 = ttk.Button(home, text="Send", width=15, command=lambda: raise_frame(page, "S", status6)) button4.grid(row=0, column=1, sticky=tk.N + tk.S + tk.E + tk.W) page = ttk.Frame(root) page.grid(row=0, column=0, sticky='news') page.rowconfigure([0, 1, 2], weight=1) page.columnconfigure([0], weight=1) progress = ttk.Progressbar(page, orient="horizontal", mode="determinate", cursor='spider') progress.grid(row=1, column=0, sticky=tk.N + tk.S + tk.E + tk.W) progress["maximum"] = 100 status6 = ttk.Label(page, text="", font=LARGE_FONT, anchor=tk.CENTER) status6.grid(row=2, column=0, sticky=tk.N + tk.S + tk.E + tk.W) startpage = ttk.Frame(page) startpage.grid(row=0, column=0, sticky='news') startpage.rowconfigure([0, 1, 2], weight=1) startpage.columnconfigure([0, 1, 2], weight=1) HOST = ttk.Entry(startpage) HOST.grid(row=1, column=1, sticky=tk.N + tk.S + tk.E + tk.W) PORT = ttk.Entry(startpage) PORT.grid(row=2, column=1, sticky=tk.N + tk.S + tk.E + tk.W) PORT.insert(tk.END, '65432') button = ttk.Button( startpage, text="send", width=15, command=lambda: Thread(target=lambda: connect(page, progress, HOST.get( ), int(PORT.get()))).start()) button.grid(row=2, column=2, sticky=tk.N + tk.S + tk.E + tk.W) status = ttk.Label(startpage, text="click for connecting and sending", font=LARGE_FONT, anchor=tk.CENTER) status.grid(row=0, column=0, sticky=tk.N + tk.S + tk.E + tk.W) status1 = ttk.Label(startpage, text="", font=LARGE_FONT, anchor=tk.CENTER) status1.grid(row=0, column=2, sticky=tk.N + tk.S + tk.E + tk.W) status2 = ttk.Label(startpage, text="", font=LARGE_FONT, anchor=tk.CENTER) status2.grid(row=0, column=1, sticky=tk.N + tk.S + tk.E + tk.W) status3 = ttk.Label(startpage, text="IP ", font=LARGE_FONT, anchor=tk.CENTER) status3.grid(row=1, column=0, sticky=tk.N + tk.S + tk.E + tk.W) status4 = ttk.Label(startpage, text="PORT", font=LARGE_FONT, anchor=tk.CENTER) status4.grid(row=2, column=0, sticky=tk.N + tk.S + tk.E + tk.W) button2 = ttk.Button(startpage, text="open file", width=15, command=lambda: Open(progress)) button2.grid(row=1, column=2, sticky=tk.N + tk.S + tk.E + tk.W) center(root) menubar = tk.Menu(root) filemenu = tk.Menu(menubar, tearoff=False) filemenu.add_command(label="Home", command=lambda: raise_frame(home)) filemenu.add_command(label="Exit", command=root.destroy) menubar.add_cascade(label="MENU", menu=filemenu) root.config(menu=menubar) root.deiconify() root.resizable(width=False, height=False) raise_frame(home) root.mainloop()
pass_Label = ttk.Label(tlevel_frame) pass_Entry = ttk.Entry(tlevel_frame, font=16)#,how='⚫') pass_Btn = ttk.Button(tlevel_frame, text='OK', width=15) pass_Entry.bind('<Return>', button_click) pass_Btn.bind('<Button-1>', button_click) pass_Label.grid(row=1, column=0) pass_Entry.grid(row=2, column=0, padx=10, sticky='nsew') pass_Btn.grid(row=3, column=0, padx=10, pady=20, sticky='e') tlevel_frame.pack(fill=BOTH) tlevel_frame.grid_rowconfigure(1, minsize=height//3) tlevel_frame.grid_rowconfigure(2, minsize=30) tlevel_frame.grid_columnconfigure(0, minsize=width) pass_Entry.focus_set() else: passwd.destroy() root.deiconify() loader = Loader(root, password) dw = (root.winfo_screenwidth() - wd) // 2 dh = (root.winfo_screenheight() - ht) // 2 root.wm_geometry('{}x{}+{}+{}'.format(wd, ht, dw, dh)) root.title('Управление безопасностью Linux') root.resizable(width=TRUE, height=FALSE) root.protocol("WM_DELETE_WINDOW", on_closing) root.mainloop()