Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import time
- class Game:
- def __init__(self):
- self.root = Tk()
- self.canvas = Canvas(self.root, width = 600, height = 600)
- self.canvas.pack()
- self.root.update()
- self.bg = PhotoImage(file = 'bg.gif')
- for x in range(6):
- for y in range(6):
- self.canvas.create_image(100 * x,100 * y,image=self.bg,anchor='nw')
- self.sprites = []
- def mainloop(self):
- while True:
- #for sprite in self.sprites:
- self.root.update_idletasks()
- self.root.update()
- class Sprite:
- def __init__(self, game):
- self.game = game
- def move(self):
- pass
- class Platform(Sprite):
- def __init__(self, game, photo_image, x, y):
- Sprite.__init__(self, game)
- self.photo_image = photo_image
- self.image = game.canvas.create_image(x,y,image=self.photo_image,anchor='nw')
- g = Game()
- platforma1 = Platform(g, PhotoImage(file='p.gif'), 0, 0)
- g.sprites.append(platforma1)
- g.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement