|
@@ -0,0 +1,44 @@
|
|
|
|
+#Maehroboter
|
|
|
|
+#21.06.2018
|
|
|
|
+#Linda Napieralski
|
|
|
|
+#Andre Giesbrecht
|
|
|
|
+#Alexa Tschernitschek
|
|
|
|
+
|
|
|
|
+#Import Module
|
|
|
|
+import Tkinter as tk
|
|
|
|
+from Tkinter import *
|
|
|
|
+import turtle
|
|
|
|
+import random
|
|
|
|
+
|
|
|
|
+#Hauptfenster erzeugen
|
|
|
|
+Hauptfenster = tk.Tk()
|
|
|
|
+Hauptfenster.geometry('1080x720') #Fenstergroesse beim oeffnen
|
|
|
|
+
|
|
|
|
+Hauptfenster.title("Maehroboter") #Fenstertitel
|
|
|
|
+Hauptfenster["bg"] = "#A4A4A4" #Hauptfenster Background Farbe, HEX-Code fuer gruen
|
|
|
|
+xval = 2
|
|
|
|
+yval = 2
|
|
|
|
+
|
|
|
|
+#Garten erzeugen
|
|
|
|
+Garten = tk.Canvas(master = Hauptfenster, width = 500, height = 500) #Garten in Hauptfenster mit 500x500 erzeugen
|
|
|
|
+Garten.pack()
|
|
|
|
+Garten.create_rectangle (0, 500,500,0, fill = "#04B431") #Gartenposition und Fuellfarbe gruen
|
|
|
|
+
|
|
|
|
+#Roboter erzeugen
|
|
|
|
+Roboter= Garten.create_oval(xval, yval, xval+48 , yval+48 , width= 2, fill= "red") #Runder roter Roboter mit Groesse 2
|
|
|
|
+#Garten.create_text(xval+25 , yval+25 ,text="Rob") #Beschriftung des Roboters
|
|
|
|
+
|
|
|
|
+#Startposition von Rob
|
|
|
|
+
|
|
|
|
+Garten.move(Roboter, 250 ,178)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#Roboterbewegung
|
|
|
|
+x= 0.05
|
|
|
|
+y= 0.05
|
|
|
|
+Geschwindigkeit_x= random.randint(1,3)
|
|
|
|
+Geschwindigkeit_y= random.randint(1,3) #zufaellige Geschwindigkeit in y-Richtung zwischen den Werten 1-3
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Hauptfenster.mainloop()
|