Advertisement
avv210

Untitled

Sep 17th, 2021
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. from tkinter import *
  2. import pyglet as pyg
  3. from tkvideo import *
  4. # Create Tkinter instance
  5. window = Tk()
  6.  
  7. def birthday():
  8.     vidPath = 'D:\path\to\video' # ini path video nya ditaro dimana
  9.     window = pyg.window.Window()
  10.     player = pyg.media.Player()
  11.     source = pyg.media.StreamingSource()
  12.     MediaLoad = pyg.media.load( vidPath )
  13.  
  14.     player.queue( MediaLoad )
  15.     player.play()
  16.  
  17.     @window.event
  18.     def on_draw():
  19.         if player.source and player.source.video_format:
  20.             player.get_texture().blit( 50, 50 )
  21.  
  22.     pyg.app.run()
  23.  
  24. window.title( "Happy Birthday My Love" )
  25. window.geometry( '500x550' )
  26.    
  27. label = Label( window, font = ('Helvatical bold', 20), text = "Happy 19th Birthday <nama>", bd = 1, relief = "sunken" )
  28. # bagian variable textnya diubah teserah mau jadi apapun
  29. label.pack( pady = 20 )
  30.  
  31. button = Button( window, font = (20), text = "Click Me!", bg = "cyan", fg = "black", padx = 20, pady = 20, command = birthday )
  32. button.pack()
  33. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement