def create_application_root(): root = Tk() root.tk.eval('package require Tix') root.minsize(500, 300) app = Application(root) app.pack(fill=BOTH, expand=True) return root, app
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 __init__(self): self.root = Tk() self.root.title("海王秘籍") self.canvas = Canvas(self.root, width=440, height=200, bg="White") self.canvas.pack() self.time_start = time.time() #起始时间 self.label = Label(text="") #时间文本对象 self.a = 0 self.tetle = '''---------------------------------- wow钓鱼脚本v5.0(通用版) 说明:9键钓鱼,8开蚌壳,0键上鱼饵(请设置好宏),每钓鱼10分钟,自动上鱼饵 ----------------------------------- ''' self.text_start = "3秒钟后开始钓鱼" self.text_start = self.tetle + self.text_start self.frame = Frame(self.root) self.frame.pack() self.btString = Button(self.frame, text="开 始", command=self.start) self.btClear = Button(self.frame, text="结 束", command=self.over) self.btString.grid(row=1, column=1) self.btClear.grid(row=1, column=2) self.label.pack() # self.p = Process(target=dy_run.dyrun) #打开进程 # self.str1 = ('python dy_run.py') #测试环境 self.str1 = ('dy_run.exe') #exe环境
def __init__(self, master=None): Tk.__init__(self, master) self.b1 = Button(self, text="Start A*", command=self.start_alg) self.b1.grid(row=0, column=0) self.b1.configure(state="disabled") self.load_thread = threading.Thread(target=self.initImage) self.load_thread.start()
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 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 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 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 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 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 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 __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 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 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 requerimientos_activos(): ventana_requerimientos = Tk() ventana_requerimientos.title('Requerimientos activos') ventana_requerimientos.minsize(300, 200) cursor_temp = conexion.cursor() query_requerimientos = cursor_temp.execute( "Select * from REQUERIMIENTOS").fetchall() cursor_temp.close() lista_requerimientos = Listbox(ventana_requerimientos, selectmode=SINGLE) lista_requerimientos.pack() for row_requerimiento in query_requerimientos: nombre_req = '{0} - {1}'.format(row_requerimiento[0], row_requerimiento[1]) lista_requerimientos.insert(END, nombre_req) Button(ventana_requerimientos, text='Seleccionar requerimiento', command=(lambda: requerimiento(query_requerimientos[ lista_requerimientos.curselection()[0]]))).pack()
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
#!/usr/bin/env python from tkinter import Label, Button, END from tkinter.tix import Tk, Control, ComboBox top = Tk() top.tk.eval('package require Tix') lb = Label(top, text = 'Animals (in parirs; min : pair, max : dozen)') lb.pack() ct = Control(top, label = 'Number:', integer = True, max = 12, min = 2, value = 2, step = 2) ct.label.config(font = 'Helvetica -14 bold') ct.pack() cb = ComboBox(top, label = 'Type:', editable = True) for animal in ('dog', 'cat', 'hamster', 'python'): cb.insert(END, animal) cb.pack() qb = Button(top, text = 'Quit', command = top.quit, bg = 'red', fg = 'white') qb.pack() top.mainloop()
def __init__(self): Tk.__init__(self) self.init_menu()
if master: master.title("SudokuGUI") self.board = board self.board_generator(board) bframe = Frame(self) self.ng = Button(bframe, command=self.new_game, text="New Game") self.ng.pack(side='left', fill='x', expand='1') self.sg = Button(bframe, command=self.save_game, text="Save Game") self.sg.pack(side='left', fill='x', expand='1') self.lg = Button(bframe, command=self.load_game, text="Load Game") self.lg.pack(side='left', fill='x', expand='1') self.query = Button(bframe, command=self.query_board, text="Set Board Algorithm") self.query.pack(side='left', fill='x', expand='1') bframe.pack(side='bottom', fill='x', expand='1') self.make_grid() self.canvas.bind("<Button-1>", self.canvas_click) self.canvas.bind("<Key>", self.canvas_key) self.current = None self.pack() if __name__ == '__main__': board = SudokuBoard() tk = Tk() gui = SudokuGUI(tk, board) gui.mainloop()
FIRST='first' LAST='last' 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)
bull_bear_days = { 'bull_days': 0, 'bear_days': 0, 'bull_bear': 'bull', 'bull_bear_day': [ '2020-01-01', ] } with open('bull_bear_days.json', 'w') as f: # with open('C://Users//faqui//Documents//github//y_Python//bull_bear_days.json', 'w') as f: json.dump(bull_bear_days, f) 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
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()
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)
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()
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() if __name__ == "__main__": fake_root = Tk() main_page(fake_root)
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 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()
# ----------------------------------- # ------------------- 浏览器服务设置---------------------- 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),
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 * from tkinter.tix import Tk, Control, ComboBox # 升级的组合控件包 from tkinter.messagebox import showinfo, showwarning, showerror #各种类型的提示框 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)
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'
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)