Hi Guys,
My final project has come and it is to make a GUI for a program that we previously wrote. So I have to use tkinter as my package for python to get this written. Now I can't find anything on tkinter and python 3.2 or any GUI "designers" for 3.2. I've seen a lot of python 2 code but none for 3. This is a really basic program and only needs 2 text input fields and a button. Would anyone help/point me in the right direction on how to start with tkinter and gui's in python 3? I will attach a code below for anyone to get the idea of the program. Thanks!
LOWER_A_ASCII = ord("a")
LOWER_Z_ASCII = ord("z")
NUM_LETTERS = 26
def getKey():
valid = False
while (not valid):
try:
key = int(input("Enter the key value (1-25): "))
if (not 1 <= key <= 25):
raise ValueError
valid = True
except ValueError:
print("Key must be an integer between 1 and 25!")
print("Please try again.")
return key
def getText():
valid = False
while (not valid):
text = input("Enter the text: ")
valid = text.isalpha() and text.islower()
if (not valid):
print("Text must only include alphabetic lower-case letters!")
print("Please try again.")
return text
def encryptChar(ch, key):
encCode = ord(ch) + key
if (encCode > LOWER_Z_ASCII):
encCode = encCode - NUM_LETTERS
encChar = chr(encCode)
return encChar
def encryptText(text, key):
encText = ""
for ch in text:
encChar = encryptChar(ch, key)
encText = encText + encChar
return encText
def main():
key = getKey()
plainText = getText()
encryptedText = encryptText(plainText, key)
print("Plain text: %s" %plainText)
print("Encryted text: %s" %encryptedText)
main()