Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter, pygame, os
- w,h = 500,200
- root = tkinter.Tk()
- embed = tkinter.Frame(root,width=w,height=h)
- embed.pack()
- os.environ['SDL_WINDOWID'] = str(embed.winfo_id()) # this makes it work
- screen = pygame.display.set_mode((w,h))
- fpsclock = pygame.time.Clock()
- x = 0
- radius = 30
- mod = w+radius*2
- while True:
- try: root.update()
- except: break
- ticks = fpsclock.tick()
- if ticks>100: continue
- dt = ticks/1000
- screen.fill((0,0,0))
- pygame.draw.circle(screen,(255,255,255),(int(x)-radius,100),radius)
- pygame.display.flip()
- x = (x+dt*100)%mod
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement