I have been using python for about a year now in my current job and currently trying to learn about classes. For some reason I am am not able to call the class Game. When I run the code below I get a small box that shows up without any color or sizing and from what I can tell I am unable to print certain variables such as game.width. Any idea what I am missing on this or doing wrong?
import tkinter as tk #display graphic user interface
class Game(tk.Frame):
def __init_(self, master):
super(Game,self).__init__(master)
#create window
self.width = 1000;
self.height = 400;
#create canvas
self.canvas = tk.Canvas(self, bg = 'blue',
width = self.width,
height = self.height)
self.canvas.pack()
self.pack()
self.items = {}
def init_game(self):
self.start_game()
def start_game(self):
self.canvas.unbind('<space>') #press space bar
if __name__ == '__main__':
root=tk.Tk()
root.title('Brick Breaker')
game = Game(root) #calling game function
game.mainloop() #loops around game