Browse Source

Optimierung der Namenseingabe + Anzeige des Namens + Anzeige des Punktestands

Kristin 7 years ago
parent
commit
fcba9bbf0e
1 changed files with 12 additions and 11 deletions
  1. 12 11
      pingpong.py

+ 12 - 11
pingpong.py

136
 #-------------------------------------------------------------------------
136
 #-------------------------------------------------------------------------
137
 # Namenseingabe
137
 # Namenseingabe
138
 
138
 
139
-def show_entry_fields():
140
-   e1 = Entry(tk)
141
-   print("Name: %s" % (e1.get()))
142
 
139
 
140
+def anzeige():
143
 
141
 
144
-def name_eingabe():
145
-   tk = Tk()
146
-   Label(tk, text="Name").grid(row=0)
142
+   def show_entry_fields():
143
+      print("First Name: %s" % (e1.get()))
147
 
144
 
148
-   e1 = Entry(tk)
145
+   master = Tk()
146
+   Label(master, text="First Name").grid(row=0)
149
 
147
 
150
-   e1.grid(row=0, column=1)
148
+   e1 = Entry(master)
151
 
149
 
152
-   Button(tk, text='Show', command=show_entry_fields).grid(row=3, column=0, sticky=W, pady=4)
150
+   e1.grid(row=0, column=1)
153
 
151
 
154
-   print("Name: %s" % (e1.get()))
152
+   Button(master, text='Show', command=show_entry_fields).grid(row=3, column=1, sticky=W, pady=4)
155
 
153
 
156
    mainloop()
154
    mainloop()
157
 
155
 
168
     tk.update()
166
     tk.update()
169
     time.sleep(0.01)
167
     time.sleep(0.01)
170
 
168
 
169
+print "Punktestand: ", ball.score
170
+
171
 if ball.hit_bottom == True:
171
 if ball.hit_bottom == True:
172
 
172
 
173
-    name_eingabe()
173
+    anzeige()
174
+
174
 
175
 
175
 #------------------------------------------------------------------------------------------------------------------
176
 #------------------------------------------------------------------------------------------------------------------
176
 
177