Skip to content

Instantly share code, notes, and snippets.

@NickersF
Created January 4, 2015 03:35
Show Gist options
  • Save NickersF/b4045431dda0b40bce0c to your computer and use it in GitHub Desktop.
Save NickersF/b4045431dda0b40bce0c to your computer and use it in GitHub Desktop.
Python 2.7 Tkinter example.
from Tkinter import *
# main application
master = Tk()
master.geometry("250x150+300+300")
# empty lsit for values
sqrLst = []
multval = 0
# generate 11 squares of 2
def getNums():
for i in range(11):
del sqrLst[10:]
multval = 2 ** i
sqrLst.append(multval)
# print 11 sqaures of 2
def prntNums():
print sqrLst[:]
return 0
getbutton = Button(master, text="Get 11 Squares of 2", command=getNums)
getbutton.pack()
printbutton = Button(master, text="Print Sqaures", command=prntNums)
printbutton.pack()
mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment