Skip to content

Instantly share code, notes, and snippets.

@bluemyria
Created November 10, 2017 16:25
Show Gist options
  • Save bluemyria/7571f5de0c8baf41d560065ea96d307e to your computer and use it in GitHub Desktop.
Save bluemyria/7571f5de0c8baf41d560065ea96d307e to your computer and use it in GitHub Desktop.
PLAYGROUND_WIDTH=300
PLAYGROUND_HEIGHT=200
PLAYGROUND_COLOR='white'
SNAKE_HEAD_COLOR='green'
SNAKE_BODY_COLOR='green'
SNAKE_MOVING_SPEED=10
try:
import Tkinter
except:
import tkinter as Tkinter
import time, random
# Creating Main Function
class main(Tkinter.Tk):
def __init__(self, *args, **kwargs):
Tkinter.Tk.__init__(self, *args, **kwargs)
# Trigger Of Other Functions
self.creating_playground()
self.creating_snake_head()
self.creating_snake_moving_settings()
self.creating_score_board()
self.bind('<Any-KeyPress>',self.connecting_head_with_keys)
# Creating Score Board
def creating_score_board(self):
return
# Updating Score Board
def update_score_board(self):
return
# Creating Snake Moving Settings
def creating_snake_moving_settings(self):
return
# Creating Snake Moving Head
def connecting_head_with_keys(self, event=None):
key=event.keysym
if key=='Left':
self.turn_left()
elif key=='Right':
self.turn_right()
elif key=='Up':
self.turn_up()
elif key=='Down':
self.turn_down()
else:
pass
return
# Creating snake Head
def creating_snake_head(self):
return
# Creating Ground
def creating_playground(self):
return
# Script Trigger
if __name__ == '__main__':
root=main(className=" Schlangenspiel ")
while True:
root.update()
root.update_idletasks()
#root.re_update()
time.sleep(0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment