使用pygame和tkinter播放视频

时间:2015-06-30 14:39:59

标签: python user-interface video

我想播放我的文档中的视频,并且已经有了这个tkinter代码,但是当按下此按钮时,我无法弄清楚如何播放视频,有人可以帮忙吗?

import Tkinter as tkinter
import time
import webbrowser
import pygame
window = tkinter.Tk()
window.title("Matthew's Login")
window.wm_iconbitmap('matt.ico')
window.configure(background='#3399FF')
username = ['Matthew']
password = ['123']

def callback():
    global username
    global password
    usr = ent.get()
    pas = ent2.get()
    x = 0
    for i in range (0,len(username)):
        if usr == username[x]:
            time.sleep(1)
            if pas == password[x]:
                window2 = tkinter.Tk()
                window2.title("Matthew's Window")
                window2.wm_iconbitmap('favicon.ico')
                def click():
                    #THIS IS THE PLACE WHERE I WANT THE VIDEO TO PLAY IN THE WINDOW
                button = tkinter.Button(window2, text = 'click me plz', command=click)
                button.pack()
                window2.mainloop()   
            else:
                 time.sleep(0.1)   
        else:
            time.sleep(0.1)
        x += 1
    return

def newuser():
    global username
    global password
    usr2 = ent.get()
    pas2 = ent2.get()
    username.append(usr2)
    password.append(pas2)

lbl0 = tkinter.Label(window, text="Please login to continue", bg='#3399FF', font=("Comic Sans MS", 16))
lbl0.pack()

lbl = tkinter.Label(window, text ="Username", bg='#3399FF', font=("Comic Sans MS", 10))
ent = tkinter.Entry(window, bg='#99CCFF')
lbl2 = tkinter.Label(window, text ="Password", bg='#3399FF', font=("Comic Sans MS", 10))
ent2 = tkinter.Entry(window, bg='#99CCFF')
btm = tkinter.Button(window, text = "Login", bg='#99CCFF', font=("Comic Sans MS", 10), command = callback)
btm2 = tkinter.Button(window, text = "Create new account", bg='#99CCFF', font=("Comic Sans MS", 10), command = newuser)
lbl.pack()
ent.pack()
lbl2.pack()
ent2.pack()
btm.pack()
btm2.pack()

window.mainloop()

0 个答案:

没有答案