Example #1
0
    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()
Example #3
0
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()
Example #4
0
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()
Example #5
0
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()
Example #6
0
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()
Example #7
0
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()
Example #8
0
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
Example #9
0
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)
Example #10
0
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()
Example #11
0
    def all_clear(self):
        self.clear()
        self.total = 0

    def sign(self):
        self.eq = False
        self.current = -(float(text_box.get()))
        self.display(self.current)


sum1 = Calc()
root = Tk()
calc = tkinter.Frame(root)
calc.grid()

root.title("Calculator")
text_box = tkinter.Entry(calc,
                         justify=tkinter.RIGHT,
                         width=30,
                         font="Times 16 bold")
text_box.grid(row=0, column=0, columnspan=8, padx=30, pady=30)
text_box.insert(0, "0")
#text_box.focus()

#operator=""
#text_Input=StringVar()

numbers = "789456123"
i = 0
bttn = []
for j in range(1, 4):
Example #12
0
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)
Example #13
0
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)

button1 = Button(root, text="注销", activeforeground="black", bg="white",bd=5, font=("Arial",12), width=8, height=3)
Example #14
0
    def end_game(self):
        self.delete(ALL)
        self.create_text(
            self.winfo_width() // 2,
            self.winfo_height() // 2,
            text=f"Score: {self.assets[AssetsEnum.BOARD.value].score}",
            fill="#fff",
            font=('Lucida Sans Unicode', 22))

    def snake_collision(self):
        x, y = self.assets[AssetsEnum.SNAKE.value].positions[0]
        for position in self.assets[AssetsEnum.SNAKE.value].positions[1:]:
            if position[0] == x and position[1] == y:
                self.end_game()


if __name__ == '__main__':
    snake = Snake()
    board = Board()
    food = Food()
    assets = [snake, food, board]

    root = Tk()
    root.title("Snake Game")
    root.resizable(False, False)

    SnakeGame(assets)

    root.mainloop()
Example #15
0
    def cc():
        capture = cv.VideoCapture(0)
        while True:
            ret, frame = capture.read()  #从摄像头读取照片
            frame = cv.flip(frame, 1)  #翻转 0:上下颠倒 大于0水平颠倒
            cv2image = cv.cvtColor(frame, cv.COLOR_BGR2RGBA)
            img = Image.fromarray(cv2image)
            image_file = ImageTk.PhotoImage(img)
            canvas.create_image(0, 0, anchor="nw", image=image_file)

    t = threading.Thread(target=cc)
    t.start()


root = Tk()  # 初始化Tk()
root.title("服创开发图片集标记工具-Made by Sensorjang")  # 设置窗口标题
root.geometry("1000x800")  # 设置窗口大小 注意:是x 不是*
root.resizable(width=True,
               height=True)  # 设置窗口是否可以变化长/宽,False不可变,True可变,默认为True
root.tk.eval('package require Tix')  #引入升级包,这样才能使用升级的组合控件

lable = Label(root,
              text="program for deviding vedio made by QP",
              bg="gray",
              bd=10,
              font=("Arial", 24),
              width=40,
              height=3)
lable.pack(side=TOP)

canvas = Canvas(root, width=800, height=600)
Example #16
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()
Example #17
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

root.tk.eval('package require Tix')  #引入升级包,这样才能使用升级的组合控件
Example #18
0
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()
Example #19
0
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()
Example #20
0
    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()
Example #21
0
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()
Example #22
0
# -----------------------------------


# ------------------- 浏览器服务设置----------------------
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)
Example #23
0
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()
Example #24
0
class CanvasDemo:
    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 start(self):
        self.time_start = time.time()  #起始时间
        self.canvas.delete("rect", "oval", "arc", "polygon", "line", "string")

        self.canvas.create_text(220,
                                50,
                                text=self.text_start,
                                font="Tine 10 bold",
                                tags="string")
        self.a = 1
        self.p = subprocess.Popen(self.str1, shell=True)  #进程启动

        return self.a, self.p

    #结束按钮
    def over(self):
        self.canvas.delete("rect", "oval", "arc", "polygon", "line", "string")
        self.label.configure(text="运行了00时00分00秒")  #初始界面显示的文本
        self.tetle_over = self.tetle + self.over_time()
        self.canvas.create_text(220,
                                50,
                                text=self.tetle_over,
                                font="Tine 10 bold",
                                tags="string")
        self.a = 0
        self.time_start = time.time()
        # self.p.kill()  # 终止子进程            //windows下不好使
        os.system('taskkill /t /f /pid {}'.format(self.p.pid))  ##shell命令 结束进程

        return self.a, self.time_start

    #计算用时
    def over_time(self):
        time_new = time.time()
        timestamp = time_new - self.time_start
        m, s = divmod(timestamp, 60)
        h, m = divmod(m, 60)
        over_time = "程序一共运行了%02d时%02d分%02d秒" % (h, m, s)
        return over_time

    def update_clock(self):
        time_new = time.time()
        timestamp = time_new - self.time_start
        m, s = divmod(timestamp, 60)
        h, m = divmod(m, 60)
        shijian = "运行了%02d时%02d分%02d秒" % (h, m, s)

        if self.a == 1:
            self.label.configure(text=shijian)
        self.root.after(50, self.update_clock)

    def run(self):
        self.update_clock()
        self.canvas.create_text(220,
                                50,
                                text=self.tetle,
                                font="Tine 10 bold",
                                tags="string")
        self.root.mainloop()
Example #25
0
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()
Example #26
0
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()
Example #27
0
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()