def prod(): root2 = Tk() root2.geometry('400x170+450+250') root2.title('Продукты в АТБ') def prodi(): global user_input user_input = (entry_1.get()) root2.destroy() def how_much(): window = Tk() window.geometry('300x250+530+180') lbl0 = Label(window, text='У Вас примерно:', font=("Cambria", 22), fg="blue") lbl0.place(x=60, y=10) lbl = Label(window, text=[money], font=("Cambria", 40), fg="blue") lbl.place(x=100, y=60) lbl1 = Label(window, text='Грв.', font=("Cambria", 20), fg="blue") lbl1.place(x=100, y=150) window.after(2000, lambda: window.destroy()) window.mainloop() def end(): pass label = Label(root2, text="Какой продукт берём?", fg='#000875', font=("Cambria", 20)) entry_1 = Entry(root2, font=("Ubuntu", 20), fg='#000875', bg='LightCyan', justify='center') text = Label(root2, text='Название продукта:', fg='#DA0700', font='Cambria') btn = Button(root2, text="Беру!", command=prodi, bg="lime", font='Cambria') btn2 = Button(root2, text="Сейчас у маня...", command=how_much, bg="LightGray", font='Cambria') btn3 = Button(root2, text="Хорош", command=end, font='Cambria') label.place(x=50, y=10) text.place(x=110, y=50) entry_1.place(x=40, y=70) entry_1.focus_set() btn.place(x=40, y=120) btn2.place(x=190, y=120) btn3.place(x=320, y=120) root2.mainloop()
def makesure(skin): def delt(): cv2.destroyWindow("frame") cv2.destroyWindow("RESULT") root2.destroy() def suss(): save() cv2.destroyWindow("frame") cv2.destroyWindow("RESULT") root2.destroy() root2 = Tk() # 初始化Tk() root2.title("INDEX") # 设置窗口标题 root2.geometry("400x400") # 设置窗口大小 注意:是x 不是* root2.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True root2.tk.eval('package require Tix') #引入升级包,这样才能使用升级的组合控件 lable = Label(root2, text="Do u want to save the result pic?", bg="blue",bd=10, font=("Arial",12), width=30, height=3) lable.pack(side=TOP) button=Button(root2,text='Confirm',command=suss,activeforeground="black",activebackground='blue',bg='green',fg='white') button.pack(side=BOTTOM) button=Button(root2,text='Delete',command=delt,activeforeground="black",activebackground='blue',bg='red',fg='white') button.pack(side=BOTTOM) cv2.namedWindow("RESULT", cv2.WINDOW_GUI_EXPANDED) cv2.imshow("RESULT",skin) root2.mainloop()
def stop_climbing(): root6 = Tk() root6.geometry('600x130+400+300') story = Label(root6, text='''Возможно у Вас недостаточно денег, для будущих покупок! Пройдите к кассе!''', font=('Arial', 20), fg='blue') story.place(x=5, y=20) root6.after(2000, lambda: root6.destroy()) root6.mainloop()
def speak(): root8 = Tk() root8.geometry('420x100+550+200') lbl = Label(root8, text='''Если Вам интересны наши цены подойдите к табличке!''', font=("Cambria", 20), fg="DarkSlateBlue") lbl.place(x=1, y=15) root8.after(2000, lambda: root8.destroy()) root8.mainloop()
def sms(): # Вы оплатили товар root3 = Tk() root3.geometry("500x200+350+250") root3.title('Window name') root3['bg'] = '#FFA07A' def goodluck(): sl.destroy() btn1.destroy() btn2.destroy() gd = Label(root3, text="Хорошего Вам дня!", font="Broadway 20", fg="green", bg="#C0C0C0") gd.place(x=120, y=70) def shet(): sl.destroy() btn1.destroy() btn2.destroy() gd = Label(root3, text="Вызываем полицию?", font="Broadway 20", fg="black", bg="#C0C0C0") gd.place(x=100, y=70) sl = Label(text='У Вас оплачены продукты?', font='Comfortaa 20', fg='black', bg='#FFA07A') btn1 = Button(root3, text='ДА', bg='#228B22', fg='#ccc', width=13, height=3, command=goodluck) btn2 = Button(root3, text='НЕТ', bg='#FF0000', fg='#ccc', width=13, height=3, command=shet) sl.pack() btn1.place(x=120, y=80) btn2.place(x=270, y=80) root3.mainloop()
def mainctrl(): mc = Tk() mc.title("主动控制") mc.geometry("250x250") bup = Button(mc, text="向上") bdown = Button(mc, text="向下") bleft = Button(mc, text="向左") bright = Button(mc, text="向右") bup.pack() bdown.pack() bleft.pack() bright.pack() mc.mainloop()
def navigation(): navi = Tk() navi.title("自主导航") navi.geometry("250x250") b1 = Button(navi, text="显示位置") b1.pack() b2 = Button(navi, text="设置目标点") b2.pack() b3 = Button(navi, text="建立地图") b3.pack() bright = Button(navi, text="开始导航", ) bright.pack() navi.mainloop()
def how_much(): window = Tk() window.geometry('300x250+530+180') lbl0 = Label(window, text='У Вас примерно:', font=("Cambria", 22), fg="blue") lbl0.place(x=60, y=10) lbl = Label(window, text=[money], font=("Cambria", 40), fg="blue") lbl.place(x=100, y=60) lbl1 = Label(window, text='Грв.', font=("Cambria", 20), fg="blue") lbl1.place(x=100, y=150) window.after(2000, lambda: window.destroy()) window.mainloop()
def no_product(): root4 = Tk() root4.geometry('700x100+300+250') root4.title('Нет продукта') root4['bg'] = 'PapayaWhip' text2 = Label(root4, text='Извините, такого продукта в нашем магазине нет!', bg='PapayaWhip', fg='Red', font=('Comfortaa', 16)) text2.place(x=30, y=20) root4.after(1000, lambda: root4.destroy()) root4.mainloop()
def yes(): global money money = float(entry_1.get()) win = Tk() win.geometry('300x250+530+180') lbl0 = Label(win, text='У Вас с собой:', font=("Cambria", 20), fg="blue") lbl0.place(x=60, y=10) lbl = Label(win, text=[money], font=("Cambria", 40), fg="blue") lbl.place(x=100, y=60) lbl1 = Label(win, text='Грв.', font=("Cambria", 30), fg="blue") lbl1.place(x=100, y=150) root1.destroy() win.after(1000, lambda: win.destroy()) win.mainloop() print(money)
def store_products(): root7 = Tk() root7.geometry('830x300+300+230') story = Label(root7, text='''В магазине сегодня распродажа! масло - 54 грн мясо - 110 грн капуста - 13 грн сахар - 24.80 грн рыба - 80 грн лук - 12 грн молоко - 26 грн колбаса - 60 грн хлеб - 15 грн яйца - 32.50 грн рис - 24.60 грн майонез - 28.90 грн гречка - 38.40 грн ''', font=('Arial', 20), fg='blue') story.pack() root7.after(4000, lambda: root7.destroy()) root7.mainloop()
def signin(): sin = Tk() sin.title("登录界面") sin.geometry("250x250") v1 = StringVar() e1 = Entry(sin,textvariable=v1,width=10) e1.grid(row=100,column=200,padx=1,pady=1) lable1=Label(sin,text='用户名: ') lable1.grid(row=100,column=125) v2 = StringVar() e2 = Entry(sin,textvariable=v2,width=10) e2.grid(row=110,column=200,padx=1,pady=1) lable2=Label(sin,text='密码: ') lable2.grid(row=110,column=125) button1 = Button(sin, text="登录", command = sin.quit, activeforeground="black", bg="white",bd=5, font=("Arial",8), width=4, height=2) button1.grid(row=200,column=125) sin.mainloop
pic_label.image = img string = str(file.get()) # 预测的人 predict = img2vector(string) # 加载模型 LR = joblib.load('lr.model') predict_people = LR.predict(pca.transform(predict)) string1 = str("编号:S%s 精确度:%f 召回率:%f" % (predict_people, accuray, recall)) showinfo(title='图像分析', message=string1) # 初始化Tk() accuray, recall, pca = facefind() root = Tk() # root便是你布局的根节点了,以后的布局都在它之上 root.geometry('260x140') root.title("人脸识别系统") # 设置窗口标题 root.resizable(width=False, height=False) # 设置窗口是否可变 root.tk.eval('package require Tix') # 引入升级包,这样才能使用升级的组合控件 path = StringVar() # 跟踪变量的值的变化 Button(root, text='选择图片', command=choosepic, width=1, height=1).grid(row=1, column=1, sticky=W + E + N + S, padx=40, pady=20) # command指定其回调函数 file = Entry(root, state='readonly', text=path) file.grid(row=0, column=1, sticky=W + E + S + N, padx=6, pady=20) # 用作文本输入用 pic_label = Label(root, text='图片', padx=30, pady=10) pic_label.grid(row=0, column=2, rowspan=4, sticky=W + E + N + S) root.mainloop()
BUTT='butt' PROJECTING='projecting' ROUND='round' BEVEL='bevel' MITER='miter' # Arguments to xview/yview MOVETO='moveto' SCROLL='scroll' UNITS='units' PAGES='pages' root = Tk() root.title("hello tkinter") root.geometry("1000x700") root.resizable(width=True, height=True) root.tk.eval('package require Tix') lable2 = Label(root, text="状态", bg="gray",bd=10, font=("Arial",12), width=8, height=3) lable2.pack(anchor = NE) lable3 = Label(root, text="正常", bg="gray",bd=10, font=("Arial",12), width=8, height=3) lable3.pack(anchor = NE) lable1 = Label(root, text="当前用户", bg="gray",bd=10, font=("Arial",12), width=8, height=3) lable1.pack(anchor = NW) button1 = Button(root, text="注销", activeforeground="black", bg="white",bd=5, font=("Arial",12), width=8, height=3) button1.pack(anchor = NW)
class DbGui: db = None current_table = None def __init__(self): # init window self.root = Tk() self.root.title("dbTools") self.root.geometry('960x480') self.left = Treeview(self.root) self.right = Treeview(self.root) self.main_menu = Menu(self.root) self.init_left() self.init_right() self.init_main_menu() self.root.config(menu=self.main_menu) self.root.bind('Button-3', self.popup_menu) def connect_db(self, database=None): if database is None: self.db = GetMysqlTableComments() else: self.db = GetMysqlTableComments(database=database) self.set_left(self.db.get_tables()) def start(self): self.connect_db() self.root.mainloop() self.close() def init_left(self): self.left["columns"] = ("1", "2") self.left["show"] = "headings" self.left.column("1", width=50, anchor='center') self.left.column("2", width=50, anchor='center') self.left.heading("1", text="table") self.left.heading("2", text="comment") self.left.insert('', 'end', values=('1', '2')) self.left.place(relx=0, rely=0, relwidth=0.2, relheight=1) self.left.bind('<ButtonRelease-1>', self.left_click) def right_click(self, event): if self.current_table is None: print('please choose table!') return selection = [] for item in self.right.selection(): item_text = self.right.item(item, "values") selection.append(item_text[0]) self.current_table.set_selects(selection) def left_click(self, event): for item in self.left.selection(): item_text = self.left.item(item, "values") sql_columns = self.db.get_columns(item_text[0]) fields = get_fields_from_sql_columns(sql_columns) self.current_table = Table(item_text, fields) self.set_right(get_columns_from_fields(fields)) break def init_right(self): self.right["columns"] = ("1", "2", "3", "4", "5", "6") self.right["show"] = "headings" self.right.column("1", width=50, anchor='center') self.right.column("2", width=50, anchor='center') self.right.column("3", width=50, anchor='center') self.right.column("4", width=50, anchor='center') self.right.column("5", width=50, anchor='center') self.right.column("6", width=50, anchor='center') self.right.heading("1", text="column") self.right.heading("2", text="key") self.right.heading("3", text="java type") self.right.heading("4", text="sql type") self.right.heading("5", text="max size") self.right.heading("6", text="comment") self.right.place(relx=0.2, rely=0, relwidth=0.8, relheight=1) self.right.bind('<ButtonRelease-1>', self.right_click) def set_left(self, values): replace_tree_view(self.left, values) def set_right(self, values): replace_tree_view(self.right, values) def init_main_menu(self): # 被注释代码为在菜单嵌入子菜单 # menu_run = Menu(self.main_menu) # self.main_menu.add_cascade(label="运行", menu=menu_run) self.main_menu.add_command(label="生成", command=self.generate) # menu_run.add_separator() self.main_menu.add_command(label="退出", command=self.root.destroy) def close(self): if self.db.connected: self.db.close_db() print('---closed---') def generate(self): if self.current_table is None: print('please choose table!') return print('---start generate---') self.current_table.generate() print('---end generate---') def popup_menu(self, event): self.main_menu.post(event.x_root, event.y_root)
def resize(ev=None): lable.config(font='Helvetica -%d bold' % scale.get()) def click(): print("点击了一次") if __name__ == "__main__": # root是布局的根节点 root = Tk() # 初始化tk # 设置窗口标题 root.title("hello tkinter") # 设置窗口大小 注意:是X 不是* root.geometry("1024x768") # 设置窗口是否可以变化长/宽,False不可变,True可变 root.resizable(width=True, height=True) # 引入升级包,这样才能使用升级的组合控件 root.tk.eval('package require Tix') lable = Label(root, text="label", bg="pink", bd=10, font=("Arial", 12), width=8, height=3) lable.pack(side=LEFT) # 按钮 """
# ------------------- 浏览器服务设置---------------------- chromedriver = "C:\\Users\\sgm\\Desktop\\sgm\\autoOrderTMall\\chromedriver.exe" chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument('--disable-gpu') chrome_options.add_argument('--no-sandbox') # ------------------------------------------------------- isStart = False browser = False root = Tk(); #初始化tk root.title("create by sgm") # 设置窗口标题 root.geometry("400x230") # 设置窗口大小 root.resizable(width=False, height=False) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True # root.tk.eval('package require Tix') #引入升级包,这样才能使用升级的组合控件 # 提示 labelLink = Label(root, text="网址:", font=("Microsoft YaHei",12), width=8, height=3, anchor=W) labelLink.grid(row = 0) # 输入框 entryLink = Entry(root, font=("Microsoft YaHei",12), width=25) entryLink.grid(row = 0, column = 1) buttonOpenLink=Button(root, text='打开链接', command=lambda:threadIt(openLink), padx=20) buttonOpenLink.grid(row = 1)
class Karaoke(): def __init__(self): print('Pyhon version {}.{}.{}' . format(*sys.version_info)) # print(os.getenv('PATH')) # Get the environment path variable # print(os.getcwd()) # Placeholder # self.currentSong = {'src' : 'musics/Vietnamese/Tre Productions - Nguoi Ay Va Toi Em Phai Cho Ai/Anh Co Quen Em - Cam Ly and VQL.vob', 'track' : 2} self.currentSong = {'src' : 'musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB', 'track' : 2} # Init GUI self.gui = Tk() self.gui.protocol("WM_DELETE_WINDOW", self.onDeleteWindow) self.gui.geometry("450x450") self.gui.title(self.currentSong['src'] + ' Track : ' + str(self.currentSong['track'])) self.guiContainer = Frame(self.gui) self.guiContainer.pack() self.instance = vlc.Instance() self.player = self.instance.media_player_new() self.vlcEvents = self.player.event_manager() self.vlcEvents.event_attach(vlc.EventType.MediaPlayerEndReached, self.onEndReached) # self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src'])) # self.player.play() slider = Scale(self.gui,orient=HORIZONTAL,length=300,width=20,sliderlength=10,from_=0,to=1000,tickinterval=100) slider.pack() nextBtn = Button(self.guiContainer) nextBtn['text'] = "Next" nextBtn.bind("<Button-1>", self.onNextClick) nextBtn.pack() toggleTrackBtn = Button(self.guiContainer, text="Toggle Track", command=self.onToggleTrackBtnClick) toggleTrackBtn.pack() # print('Pyhon version {}.{}.{}' . format(*sys.version_info)) def setInterval(func, sec): def funcWrapper(): setInterval(func, sec) func() self.timer = Timer(sec, funcWrapper) self.timer.start() return self.timer # self.timer = setInterval(self.get_playlist, 2) self.iniVLC(self.currentSong) # Windows only thing self.gui.mainloop() # Only for Windows user for now def get_playlist(self): # print('Running') r = requests.get('https://karaoke.firebaseio.com/playlist.json') songDict = r.json() # Sort the list listSorted = sorted(songDict.keys()) # Get the first song hash firstSongOjbKey = listSorted[0] # Get the first song data songObj = songDict[firstSongOjbKey] if songObj['src'] != self.currentSong['src'] : # Play new song self.iniVLC(songObj) else : if songObj['track'] != self.currentSong['track'] : self.currentSong['track'] = songObj['track'] self.player.audio_set_track(songObj['track']) return self.currentSong def iniVLC(self, sObj): self.currentSong = sObj # self.mediaListPlayer = vlc.MediaL # Init VLC self.player.stop() # self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src'])) path = os.path.join('../../../', self.currentSong['src']) o = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB' u = o.encode('utf-8', 'strict') d = str(u) # Convert to String n = d.replace("b'", "'") n = n.replace("'", '') w = '../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB' # utf-8 bytes as a string print('w', type(w), w) l = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Äà o - SÆ¡n Ca.VOB' print('l', type(l), l) print (w == n) # ../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB # self.player.set_media(self.instance.media_new('../../../musics/Vietnamese/Ai L\\\\xc3\\\\xaan X\\\\xe1\\\\xbb\\\\xa9 Hoa \\\\xc4\\\\x90\\\\xc3\\\\xa0o - S\\\\xc6\\\\xa1n Ca.VOB')) self.player.set_media(self.instance.media_new()) # self.player.set_media(self.instance.media_new(ub)) self.player.play() # if sys.platform == "linux2": # for Linux using the X Server # self.player.set_xwindow(guiContainer.winfo_id()) # elif sys.platform == "win32": # for Windows # self.player.set_hwnd(guiContainer.winfo_id()) # elif sys.platform == "darwin": # for MacOS # self.player.set_agl(guiContainer.winfo_id()) # def onToggleTrackBtnClick(self): audioTrack = self.player.audio_get_track() trackNum = 1 if int(audioTrack) == 2 else 2 self.player.audio_set_track(trackNum) print('onToggleTrackBtn click') def onNextClick(self, event): self.gui.destroy() def onEndReached(self, evt): print(evt) def onPlay(self, evt): print('onPlay') def onDeleteWindow(self): print('exit') self.gui.destroy() self.timer.cancel() # os.abort() sys.exit()
else: pass root = Tk() # 初始化Tk() root便是你布局的根节点了,以后的布局都在它之上 root.title("行者桑结") # 设置窗口标题 width = root.winfo_reqwidth() + 400 #窗口大小 height = root.winfo_reqheight() + 100 #窗口大小 x, y = (root.winfo_screenwidth() - width) / 2, (root.winfo_screenheight() - height) / 2 #root.attributes("-toolwindow", 1) #参数1,设置工具栏样式窗口。#参数1,没有最大化和最小化的按钮。 #root["background"] = "DarkBlue" root["bd"] = 4 root["relief"] = GROOVE #RAISED root.geometry('%dx%d+%d+%d' % (width, height, x, y)) #窗口位置居中,设置窗口大小 注意:是x 不是* root.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True root.tk.eval('package require Tix') #引入升级包,这样才能使用升级的组合控件 #创建一个状态显示标签 info_status = Label(root, width=300, relief=GROOVE, font=("Arial", 13), fg='red', bd=1, anchor=SW) info_status.place(x=0,
def location_page(root_function_or_final): global File_location File_location = "null" root_function_or_final.destroy() root = Tk() root.title("A Compressed Software By Wang,Xu,Wu,Huang") root.geometry("999x666") root.resizable(width=True, height=True) root.eval('package require Tix') root['bg'] = '#FFFAF0' text1 = Label( root, text="-⭐-Input The Location Of File You Want To Deal With-⭐-", bg="#FFFAF0", fg="BLACK", font=("黑体", 20), width=70, height=2, anchor="center") text1.place(x=10, y=40) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=480) location_input = StringVar() location_input = Entry(root, bg="#ADD8E6", width=100) location_input.place(x=100, y=330) button1_3 = Button(root, text="Start", font=("宋体", 10), command=lambda: get_location(root, location_input), width=5, height=1, bg="#AFEEEE") button1_3.place(x=866, y=330) button1_3 = Button(root, text="Return", font=("宋体", 15), command=lambda: function_page(root), width=5, height=1, bg="#48D1CC") button1_3.place(x=780, y=600) button1_4 = Button(root, text="Exit", font=("宋体", 15), command=lambda: sys.exit(), width=5, height=1, bg="#20B2AA") button1_4.place(x=860, y=600) root.mainloop()
def main_page(root_function): global Algorithm_choice Algorithm_choice = 0 root_function.destroy() root = Tk() root.title("A Compressed Software By Wang,Xu,Wu,Huang") root.geometry("999x666") root.resizable(width=True, height=True) root.eval('package require Tix') root['bg'] = '#FFFAF0' text1 = Label(root, text="-⭐-Choose the compressed algorithm you want-⭐-", bg="#FFFAF0", fg="BLACK", font=("黑体", 25), width=50, height=2, anchor="center") text1.place(x=70, y=40) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=480) button1_1 = Button(root, text="Huffman", font=("宋体", 25), command=lambda: algorithm(1, root), width=15, height=2, bg="#FFE4C4") button1_1.place(x=70, y=300) button1_2 = Button(root, text="Zip", font=("宋体", 25), command=lambda: algorithm(2, root), width=15, height=2, bg="#F4A460") button1_2.place(x=363, y=300) button1_3 = Button(root, text="Lz4", font=("宋体", 25), command=lambda: algorithm(3, root), width=15, height=2, bg="#CD5C5C") button1_3.place(x=656, y=300) button1_4 = Button(root, text="Exit", font=("宋体", 15), command=lambda: sys.exit(), width=5, height=1, bg="#E9967A") button1_4.place(x=860, y=600) root.mainloop()
from tkinter import * from tkinter import messagebox from tkinter.tix import Tk import sys import pygame from PIL.ImageTk import PhotoImage from pygame import mixer tk = Tk() w, h = tk.winfo_screenwidth(), tk.winfo_screenheight() tk.geometry("1400x800") # tk.wm_state('zoomed') our_image = PhotoImage(file='img/map.png') our_label = Label(tk) our_label.image = our_image our_label['image'] = our_label.image our_label.place(x=50, y=0) def destroy(): # Досрочный Game Over if messagebox.askokcancel("Quit", "Do you want to quit?"): sys.exit() b1 = Button(tk, text="Start", command=tk.destroy, fg='Navy', font=("Georgia", 16, "bold")) b1.place(x=1030, y=500, width=70, height=40) b1["bg"] = "SpringGreen"
from tkinter import * from tkinter.tix import Tk, Control, ComboBox #升级的组合控件包 from tkinter.messagebox import showinfo, showwarning, showerror #各种类型的提示框 root = Tk() # 初始化Tk() root.title("计算加班") # 设置窗口标题 root.geometry("500x250") # 设置窗口大小 注意:是x 不是* root.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True root.tk.eval('package require Tix') #引入升级包,这样才能使用升级的组合控件 lable = Label(root, text="label", bg="pink", bd=10, font=("Arial", 12), width=8, height=3) lable.pack(side=LEFT)
class Karaoke(): def __init__(self): print('Pyhon version {}.{}.{}'.format(*sys.version_info)) # print(os.getenv('PATH')) # Get the environment path variable # print(os.getcwd()) # Placeholder # self.currentSong = {'src' : 'musics/Vietnamese/Tre Productions - Nguoi Ay Va Toi Em Phai Cho Ai/Anh Co Quen Em - Cam Ly and VQL.vob', 'track' : 2} self.currentSong = { 'src': 'musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB', 'track': 2 } # Init GUI self.gui = Tk() self.gui.protocol("WM_DELETE_WINDOW", self.onDeleteWindow) self.gui.geometry("450x450") self.gui.title(self.currentSong['src'] + ' Track : ' + str(self.currentSong['track'])) self.guiContainer = Frame(self.gui) self.guiContainer.pack() self.instance = vlc.Instance() self.player = self.instance.media_player_new() self.vlcEvents = self.player.event_manager() self.vlcEvents.event_attach(vlc.EventType.MediaPlayerEndReached, self.onEndReached) # self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src'])) # self.player.play() slider = Scale(self.gui, orient=HORIZONTAL, length=300, width=20, sliderlength=10, from_=0, to=1000, tickinterval=100) slider.pack() nextBtn = Button(self.guiContainer) nextBtn['text'] = "Next" nextBtn.bind("<Button-1>", self.onNextClick) nextBtn.pack() toggleTrackBtn = Button(self.guiContainer, text="Toggle Track", command=self.onToggleTrackBtnClick) toggleTrackBtn.pack() # print('Pyhon version {}.{}.{}' . format(*sys.version_info)) def setInterval(func, sec): def funcWrapper(): setInterval(func, sec) func() self.timer = Timer(sec, funcWrapper) self.timer.start() return self.timer # self.timer = setInterval(self.get_playlist, 2) self.iniVLC(self.currentSong) # Windows only thing self.gui.mainloop() # Only for Windows user for now def get_playlist(self): # print('Running') r = requests.get('https://karaoke.firebaseio.com/playlist.json') songDict = r.json() # Sort the list listSorted = sorted(songDict.keys()) # Get the first song hash firstSongOjbKey = listSorted[0] # Get the first song data songObj = songDict[firstSongOjbKey] if songObj['src'] != self.currentSong['src']: # Play new song self.iniVLC(songObj) else: if songObj['track'] != self.currentSong['track']: self.currentSong['track'] = songObj['track'] self.player.audio_set_track(songObj['track']) return self.currentSong def iniVLC(self, sObj): self.currentSong = sObj # self.mediaListPlayer = vlc.MediaL # Init VLC self.player.stop() # self.player.set_media(self.instance.media_new('../../../' + self.currentSong['src'])) path = os.path.join('../../../', self.currentSong['src']) o = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Đào - Sơn Ca.VOB' u = o.encode('utf-8', 'strict') d = str(u) # Convert to String n = d.replace("b'", "'") n = n.replace("'", '') w = '../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB' # utf-8 bytes as a string print('w', type(w), w) l = '../../../musics/Vietnamese/Ai Lên Xứ Hoa Äà o - SÆ¡n Ca.VOB' print('l', type(l), l) print(w == n) # ../../../musics/Vietnamese/Ai L\xc3\xaan X\xe1\xbb\xa9 Hoa \xc4\x90\xc3\xa0o - S\xc6\xa1n Ca.VOB # self.player.set_media(self.instance.media_new('../../../musics/Vietnamese/Ai L\\\\xc3\\\\xaan X\\\\xe1\\\\xbb\\\\xa9 Hoa \\\\xc4\\\\x90\\\\xc3\\\\xa0o - S\\\\xc6\\\\xa1n Ca.VOB')) self.player.set_media(self.instance.media_new()) # self.player.set_media(self.instance.media_new(ub)) self.player.play() # if sys.platform == "linux2": # for Linux using the X Server # self.player.set_xwindow(guiContainer.winfo_id()) # elif sys.platform == "win32": # for Windows # self.player.set_hwnd(guiContainer.winfo_id()) # elif sys.platform == "darwin": # for MacOS # self.player.set_agl(guiContainer.winfo_id()) # def onToggleTrackBtnClick(self): audioTrack = self.player.audio_get_track() trackNum = 1 if int(audioTrack) == 2 else 2 self.player.audio_set_track(trackNum) print('onToggleTrackBtn click') def onNextClick(self, event): self.gui.destroy() def onEndReached(self, evt): print(evt) def onPlay(self, evt): print('onPlay') def onDeleteWindow(self): print('exit') self.gui.destroy() self.timer.cancel() # os.abort() sys.exit()
def function_page(root_main_or_ocation): global Function_choice Function_choice = 0 root_main_or_ocation.destroy() root = Tk() root.title("A Compressed Software By Wang,Xu,Wu,Huang") root.geometry("999x666") root.resizable(width=True, height=True) root.eval('package require Tix') root['bg'] = '#FFFAF0' text1 = Label(root, text="-⭐-Compress Or Uncompress-⭐-", bg="#FFFAF0", fg="BLACK", font=("黑体", 25), width=50, height=2, anchor="center") text1.place(x=70, y=40) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=480) button1_1 = Button(root, text="Compress", font=("宋体", 30), command=lambda: function(1, root), width=15, height=2, bg="#87CEEB") button1_1.place(x=150, y=300) button1_2 = Button(root, text="Uncompress", font=("宋体", 30), command=lambda: function(2, root), width=15, height=2, bg="#4682B4") button1_2.place(x=550, y=300) button1_3 = Button(root, text="Return", font=("宋体", 15), command=lambda: main_page(root), width=5, height=1, bg="#48D1CC") button1_3.place(x=780, y=600) button1_4 = Button(root, text="Exit", font=("宋体", 15), command=lambda: sys.exit(), width=5, height=1, bg="#20B2AA") button1_4.place(x=860, y=600) root.mainloop()
import random import time import os import tkinter.tix import pickle from tkinter import * from tkinter.constants import * from tkinter.tix import FileSelectBox, Tk root = Tk() root.title('Instructions for playing Sudoku') root.geometry('800x800') canvas = Canvas(root, width=1680, height=700, bg='skyblue') canvas.pack() photo = PhotoImage( file='C:\\Users\\Abhinav\\Downloads\\sudoku-instructions.png') canvas.create_image(0, 0, image=photo, anchor=NW) btn = Button(root, text='START', width=1680, height=15, fg="black", bg="pink", command=root.destroy) btn.pack(side='bottom') root.mainloop() class SudokuBoard: def __init__(self): self.clear()
def final_page(hint, time): root = Tk() root.title("A Compressed Software By Wang,Xu,Wu,Huang") root.geometry("999x666") root.resizable(width=True, height=True) root.eval('package require Tix') root['bg'] = '#FFFAF0' imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=200) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#D8BFD8", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=70, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#DDA0DD", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=282, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#BA55D3", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=494, y=480) imige1 = Label(root, text="-⭐--⭐--⭐--⭐-", bg="#8B008B", fg="#FFFAF0", font=("宋体", 8), width=34, height=1, anchor="center") imige1.place(x=706, y=480) text1 = Label(root, text=hint, bg="#FFFAF0", fg="BLACK", font=("黑体", 10), width=100, height=2, anchor="center") text1.place(x=100, y=300) text2 = Label(root, text="程序运行时间:", bg="#FFFAF0", fg="BLACK", font=("黑体", 10), width=100, height=2, anchor="center") text2.place(x=100, y=380) text3 = Label(root, text=time, bg="#FFFAF0", fg="BLACK", font=("黑体", 10), width=100, height=2, anchor="center") text3.place(x=300, y=380) text4 = Label(root, text="s", bg="#FFFAF0", fg="BLACK", font=("黑体", 10), width=3, height=2, anchor="center") text4.place(x=730, y=380) button1_3 = Button(root, text="Return", font=("宋体", 15), command=lambda: location_page(root), width=5, height=1, bg="#48D1CC") button1_3.place(x=780, y=600) button1_4 = Button(root, text="Exit", font=("宋体", 15), command=lambda: sys.exit(), width=5, height=1, bg="#20B2AA") button1_4.place(x=860, y=600) root.mainloop()
from tkinter import Label, Entry, Canvas, Button from tkinter.tix import Tk h = Tk() #creating gui h.title("Hangman Game") h.geometry("500x500") #h.configure(bg = 'white') label = Label( h, text="Enter in your guess:", ).place(x=10, y=180) #label1 = Label(h, bg = 'white', text = "The number of letters in the ranodm word is: %s." %(letterNumberStr)) #label1.place(x = 10, y = 120) input_box = Entry(h) input_box.place(x=10, y=200) #A canvas is needed so I can draw canvas = Canvas( h, bg='white') # used white background to tell where structure was at canvas.place(x=325, y=200, width=350, height=50) canvas.create_line(10, 400, 100, 400) #scaffoldPart1 canvas.create_line(30, 400, 30, 50) #scaffoldPart2 canvas.create_line(30, 50, 250, 50) #scaffoldPart3 canvas.create_line(175, 50, 175, 100) #rope h.mainloop()
from tkinter import * from tkinter.tix import Tk, Control, ComboBox #升级的组合控件包 from tkinter.messagebox import showinfo, showwarning, showerror #各种类型的提示框 root = Tk() # 初始化Tk() root.title("hello tkinter") # 设置窗口标题 root.geometry("800x1000") # 设置窗口大小 注意:是x 不是* root.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True root.tk.eval('package require Tix') #引入升级包,这样才能使用升级的组合控件 lable = Label(root, text="label", bg="pink", bd=10, font=("Arial", 12), width=8, height=3) lable.pack(side=LEFT) # Booleans NO = FALSE = OFF = 0 YES = TRUE = ON = 1 # -anchor and -sticky N = 'n' S = 's' W = 'w' E = 'e' NW = 'nw' SW = 'sw'
# temp_joints = np.append(temp_joints,pos) temp_joints = to_kinect(self._kinect,skeletons) # I do not know it is right if temp_joints.shape[0] != 0: # input data and output label # print(temp_joints) temp_label = self.model.data_input(temp_joints) if temp_label != ' ': self.last_label = temp_label # print(temp_label) self.label.set(self.last_label) # output image self.img = cv2.resize(self.img,(640,480)) current_img = Image.fromarray(self.img) imgtk = ImageTk.PhotoImage(image=current_img) self.panel.imgtk = imgtk self.panel.config(image=imgtk) self.detect_frame.after(1,self.loop) if __name__ == "__main__": # initialize Tk root = Tk() root.title("Action Recognition") root.geometry("640x550") root.resizable(width=True, height=True) # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True root.tk.eval('package require Tix') #引入升级包 basic_desk(root) root.mainloop()