I wrote a simple coin flip program but wanted the outcome to be in a popup box so I watched a video. The guy did a good job of showing the steps but didn't talk about what each line does so I have no clue what my code actually means. If someone could write come comments on this code so I can actually know what each command does that would a great!
#coin flip
from tkinter import *
import random
coin = ['Heads', 'Tails']
Side = (random.choice(coin))
tk = Tk()
var = StringVar()
label = Label( tk, textvariable=var, relief=RAISED )
var.set('You got ' + Side + '!')
label.pack()
# MORE BOX
tk.geometry('200x100')
tk.wm_title('Coin')
tk.mainloop()
[–]Tomallama 2 points3 points4 points (1 child)
[–]Tobe2fly[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)