|
@@ -13,7 +13,7 @@ import sys
|
13
|
13
|
|
14
|
14
|
|
15
|
15
|
#----------------------------------------------------------------
|
16
|
|
-# Funktion für den Neustart des Programms
|
|
16
|
+# Funktion fuer den Neustart des Programms
|
17
|
17
|
|
18
|
18
|
def restart_program():
|
19
|
19
|
python = sys.executable
|
|
@@ -119,11 +119,13 @@ paddle = Paddle(canvas, 'black')
|
119
|
119
|
ball = Ball(canvas, 'white', 25, paddle)
|
120
|
120
|
|
121
|
121
|
|
122
|
|
-
|
123
|
|
-start_button = Button(tk, text="Spiel starten", command=tk.quit)
|
124
|
|
-start_button.pack()
|
125
|
122
|
neustart_button = Button(tk, text="Neues Spiel", command=restart_program)
|
126
|
123
|
neustart_button.pack()
|
|
124
|
+start_button = Button(tk, text="Spiel starten", command=tk.quit)
|
|
125
|
+start_button.pack()
|
|
126
|
+exit_button = Button(tk, text='Quit', command=tk.destroy)
|
|
127
|
+exit_button.pack()
|
|
128
|
+
|
127
|
129
|
|
128
|
130
|
tk.mainloop()
|
129
|
131
|
|
|
@@ -131,6 +133,29 @@ def button_action():
|
131
|
133
|
anweisungs_label.config()
|
132
|
134
|
|
133
|
135
|
|
|
136
|
+#-------------------------------------------------------------------------
|
|
137
|
+# Namenseingabe
|
|
138
|
+
|
|
139
|
+def show_entry_fields():
|
|
140
|
+ e1 = Entry(tk)
|
|
141
|
+ print("Name: %s" % (e1.get()))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+def name_eingabe():
|
|
145
|
+ tk = Tk()
|
|
146
|
+ Label(tk, text="Name").grid(row=0)
|
|
147
|
+
|
|
148
|
+ e1 = Entry(tk)
|
|
149
|
+
|
|
150
|
+ e1.grid(row=0, column=1)
|
|
151
|
+
|
|
152
|
+ Button(tk, text='Show', command=show_entry_fields).grid(row=3, column=0, sticky=W, pady=4)
|
|
153
|
+
|
|
154
|
+ print("Name: %s" % (e1.get()))
|
|
155
|
+
|
|
156
|
+ mainloop()
|
|
157
|
+
|
|
158
|
+
|
134
|
159
|
#--------------------------------------------------------------------------
|
135
|
160
|
# Schleife fuer das fortlaufende Bewegen des Balles
|
136
|
161
|
|
|
@@ -138,18 +163,14 @@ while ball.hit_bottom == False:
|
138
|
163
|
|
139
|
164
|
ball.draw()
|
140
|
165
|
paddle.draw()
|
141
|
|
- canvas.itemconfig(label, text="Highscore: "+str(ball.score))
|
|
166
|
+ canvas.itemconfig(label, text="Punktestand: "+str(ball.score))
|
142
|
167
|
tk.update_idletasks()
|
143
|
168
|
tk.update()
|
144
|
169
|
time.sleep(0.01)
|
145
|
170
|
|
146
|
|
-while ball.hit_bottom == True:
|
|
171
|
+if ball.hit_bottom == True:
|
147
|
172
|
|
148
|
|
- ball.draw()
|
149
|
|
- paddle.draw()
|
150
|
|
- canvas.itemconfig(label, text="Highscore: "+str(0))
|
151
|
|
- tk.update_idletasks()
|
152
|
|
- tk.update()
|
153
|
|
- time.sleep(0.01)
|
|
173
|
+ name_eingabe()
|
154
|
174
|
|
|
175
|
+#------------------------------------------------------------------------------------------------------------------
|
155
|
176
|
|