I don't know why my python GUI code name program doesn't work









up vote
0
down vote

favorite












I'm a college student who's trying to learn python as we speak. I'm very new and cannot successfully run this program that allows the user to create a code name using a GUI that collects information such as the user's gender, their name, and last name. I'm struggling to make the codename function work and integrate it into my "Show" button.



If anyone has a few minutes to spare and wants to look at my code, I'd appreciate it immensely. Again, I'm sorry if I'm really new/bad at this, but I'm trying to learn.



Cheers!



from tkinter import *

class CodeNameProgram:
def __init__(self):
window = Tk()
window.title("Code Name Generator")
genderOption = StringVar()
Label(window, text="First Name").grid(row=0)
Label(window, text="Last Name").grid(row=1)

R1 = Radiobutton(window, text="Male", value="male", var=genderOption).grid(row=2,column=0, sticky=E)
R2 = Radiobutton(window, text="Female", value="female", var=genderOption).grid(row=2,column=1)

e1 = Entry(window).grid(row=0, column=1)
e2 = Entry(window).grid(row=1, column=1)

Button(window, text='Quit', command=window.quit).grid(row=3, column=0, sticky=E, pady=4)
Button(window, text='Show',command=codename).grid(row=3, column=1, pady=4)

def codename(self):
e1 = s1[:1]
if e == "a":
firstcodename = "Spring"
elif e == "b":
firstcodename = "Spring"
elif e == "c":
firstcodename = "Spring"
elif e == "d":
firstcodename = "Spring"
elif e == "e":
firstcodename = "Spring"
elif e == "f":
firstcodename = "Spring"
elif e == "g":
firstcodename = "Summer"
elif e == "h":
firstcodename = "Summer"
elif e == "i":
firstcodename = "Summer"
elif e == "j":
firstcodename = "Summer"
elif e == "k":
firstcodename = "Summer"
elif e == "l":
firstcodename = "Summer"
elif e == "m":
firstcodename = "Summer"
elif e == "n":
firstcodename = "Autumn"
elif e == "o":
firstcodename = "Autumn"
elif e == "p":
firstcodename = "Autumn"
elif e == "q":
firstcodename = "Autumn"
elif e == "r":
firstcodename = "Autumn"
else:
firstcodename = "Winter"

e2= s2[:1]
if e == "a":
lastcodename = "Thunder"
elif e == "b":
lastcodename = "Thunder"
elif e == "c":
lastcodename = "Thunder"
elif e == "d":
lastcodename = "Thunder"
elif e == "e":
lastcodename = "Thunder"
elif e == "f":
lastcodename = "Thunder"
elif e == "g":
lastcodename = "Shadow"
elif e == "h":
lastcodename = "Shadow"
elif e == "i":
lastcodename = "Shadow"
elif e == "j":
lastcodename = "Shadow"
elif e == "k":
lastcodename = "Shadow"
elif e == "l":
lastcodename = "Shadow"
elif e == "m":
lastcodename = "Shadow"
elif e == "n":
lastcodename = "Flash"
elif e == "o":
lastcodename = "Flash"
elif e == "p":
lastcodename = "Flash"
elif e == "q":
lastcodename = "Flash"
elif e == "r":
lastcodename = "Flash"
else:
lastcodename = "Terminator"

genderOption = gender
if genderOption == "male":
gender = "Mr. "
else:
gender = "Mrs. "

print(get.gender)
print(get.firstcodename)
print(get.lastcodename)

CodeNameProgram()









share|improve this question





















  • Welcome to SO, please note that '. I'm struggling to make the codename function work' is not a specific enough question for this site. Try to describe your problem more accurately. If you get an error, include the complete traceback in your message. If you don't get the expected output, include the output you get vs the expected one. As a side note: you could rewrite your conditions if 'a' <= e <= 'f': ...
    – Thierry Lathuille
    Nov 11 at 17:46














up vote
0
down vote

favorite












I'm a college student who's trying to learn python as we speak. I'm very new and cannot successfully run this program that allows the user to create a code name using a GUI that collects information such as the user's gender, their name, and last name. I'm struggling to make the codename function work and integrate it into my "Show" button.



If anyone has a few minutes to spare and wants to look at my code, I'd appreciate it immensely. Again, I'm sorry if I'm really new/bad at this, but I'm trying to learn.



Cheers!



from tkinter import *

class CodeNameProgram:
def __init__(self):
window = Tk()
window.title("Code Name Generator")
genderOption = StringVar()
Label(window, text="First Name").grid(row=0)
Label(window, text="Last Name").grid(row=1)

R1 = Radiobutton(window, text="Male", value="male", var=genderOption).grid(row=2,column=0, sticky=E)
R2 = Radiobutton(window, text="Female", value="female", var=genderOption).grid(row=2,column=1)

e1 = Entry(window).grid(row=0, column=1)
e2 = Entry(window).grid(row=1, column=1)

Button(window, text='Quit', command=window.quit).grid(row=3, column=0, sticky=E, pady=4)
Button(window, text='Show',command=codename).grid(row=3, column=1, pady=4)

def codename(self):
e1 = s1[:1]
if e == "a":
firstcodename = "Spring"
elif e == "b":
firstcodename = "Spring"
elif e == "c":
firstcodename = "Spring"
elif e == "d":
firstcodename = "Spring"
elif e == "e":
firstcodename = "Spring"
elif e == "f":
firstcodename = "Spring"
elif e == "g":
firstcodename = "Summer"
elif e == "h":
firstcodename = "Summer"
elif e == "i":
firstcodename = "Summer"
elif e == "j":
firstcodename = "Summer"
elif e == "k":
firstcodename = "Summer"
elif e == "l":
firstcodename = "Summer"
elif e == "m":
firstcodename = "Summer"
elif e == "n":
firstcodename = "Autumn"
elif e == "o":
firstcodename = "Autumn"
elif e == "p":
firstcodename = "Autumn"
elif e == "q":
firstcodename = "Autumn"
elif e == "r":
firstcodename = "Autumn"
else:
firstcodename = "Winter"

e2= s2[:1]
if e == "a":
lastcodename = "Thunder"
elif e == "b":
lastcodename = "Thunder"
elif e == "c":
lastcodename = "Thunder"
elif e == "d":
lastcodename = "Thunder"
elif e == "e":
lastcodename = "Thunder"
elif e == "f":
lastcodename = "Thunder"
elif e == "g":
lastcodename = "Shadow"
elif e == "h":
lastcodename = "Shadow"
elif e == "i":
lastcodename = "Shadow"
elif e == "j":
lastcodename = "Shadow"
elif e == "k":
lastcodename = "Shadow"
elif e == "l":
lastcodename = "Shadow"
elif e == "m":
lastcodename = "Shadow"
elif e == "n":
lastcodename = "Flash"
elif e == "o":
lastcodename = "Flash"
elif e == "p":
lastcodename = "Flash"
elif e == "q":
lastcodename = "Flash"
elif e == "r":
lastcodename = "Flash"
else:
lastcodename = "Terminator"

genderOption = gender
if genderOption == "male":
gender = "Mr. "
else:
gender = "Mrs. "

print(get.gender)
print(get.firstcodename)
print(get.lastcodename)

CodeNameProgram()









share|improve this question





















  • Welcome to SO, please note that '. I'm struggling to make the codename function work' is not a specific enough question for this site. Try to describe your problem more accurately. If you get an error, include the complete traceback in your message. If you don't get the expected output, include the output you get vs the expected one. As a side note: you could rewrite your conditions if 'a' <= e <= 'f': ...
    – Thierry Lathuille
    Nov 11 at 17:46












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm a college student who's trying to learn python as we speak. I'm very new and cannot successfully run this program that allows the user to create a code name using a GUI that collects information such as the user's gender, their name, and last name. I'm struggling to make the codename function work and integrate it into my "Show" button.



If anyone has a few minutes to spare and wants to look at my code, I'd appreciate it immensely. Again, I'm sorry if I'm really new/bad at this, but I'm trying to learn.



Cheers!



from tkinter import *

class CodeNameProgram:
def __init__(self):
window = Tk()
window.title("Code Name Generator")
genderOption = StringVar()
Label(window, text="First Name").grid(row=0)
Label(window, text="Last Name").grid(row=1)

R1 = Radiobutton(window, text="Male", value="male", var=genderOption).grid(row=2,column=0, sticky=E)
R2 = Radiobutton(window, text="Female", value="female", var=genderOption).grid(row=2,column=1)

e1 = Entry(window).grid(row=0, column=1)
e2 = Entry(window).grid(row=1, column=1)

Button(window, text='Quit', command=window.quit).grid(row=3, column=0, sticky=E, pady=4)
Button(window, text='Show',command=codename).grid(row=3, column=1, pady=4)

def codename(self):
e1 = s1[:1]
if e == "a":
firstcodename = "Spring"
elif e == "b":
firstcodename = "Spring"
elif e == "c":
firstcodename = "Spring"
elif e == "d":
firstcodename = "Spring"
elif e == "e":
firstcodename = "Spring"
elif e == "f":
firstcodename = "Spring"
elif e == "g":
firstcodename = "Summer"
elif e == "h":
firstcodename = "Summer"
elif e == "i":
firstcodename = "Summer"
elif e == "j":
firstcodename = "Summer"
elif e == "k":
firstcodename = "Summer"
elif e == "l":
firstcodename = "Summer"
elif e == "m":
firstcodename = "Summer"
elif e == "n":
firstcodename = "Autumn"
elif e == "o":
firstcodename = "Autumn"
elif e == "p":
firstcodename = "Autumn"
elif e == "q":
firstcodename = "Autumn"
elif e == "r":
firstcodename = "Autumn"
else:
firstcodename = "Winter"

e2= s2[:1]
if e == "a":
lastcodename = "Thunder"
elif e == "b":
lastcodename = "Thunder"
elif e == "c":
lastcodename = "Thunder"
elif e == "d":
lastcodename = "Thunder"
elif e == "e":
lastcodename = "Thunder"
elif e == "f":
lastcodename = "Thunder"
elif e == "g":
lastcodename = "Shadow"
elif e == "h":
lastcodename = "Shadow"
elif e == "i":
lastcodename = "Shadow"
elif e == "j":
lastcodename = "Shadow"
elif e == "k":
lastcodename = "Shadow"
elif e == "l":
lastcodename = "Shadow"
elif e == "m":
lastcodename = "Shadow"
elif e == "n":
lastcodename = "Flash"
elif e == "o":
lastcodename = "Flash"
elif e == "p":
lastcodename = "Flash"
elif e == "q":
lastcodename = "Flash"
elif e == "r":
lastcodename = "Flash"
else:
lastcodename = "Terminator"

genderOption = gender
if genderOption == "male":
gender = "Mr. "
else:
gender = "Mrs. "

print(get.gender)
print(get.firstcodename)
print(get.lastcodename)

CodeNameProgram()









share|improve this question













I'm a college student who's trying to learn python as we speak. I'm very new and cannot successfully run this program that allows the user to create a code name using a GUI that collects information such as the user's gender, their name, and last name. I'm struggling to make the codename function work and integrate it into my "Show" button.



If anyone has a few minutes to spare and wants to look at my code, I'd appreciate it immensely. Again, I'm sorry if I'm really new/bad at this, but I'm trying to learn.



Cheers!



from tkinter import *

class CodeNameProgram:
def __init__(self):
window = Tk()
window.title("Code Name Generator")
genderOption = StringVar()
Label(window, text="First Name").grid(row=0)
Label(window, text="Last Name").grid(row=1)

R1 = Radiobutton(window, text="Male", value="male", var=genderOption).grid(row=2,column=0, sticky=E)
R2 = Radiobutton(window, text="Female", value="female", var=genderOption).grid(row=2,column=1)

e1 = Entry(window).grid(row=0, column=1)
e2 = Entry(window).grid(row=1, column=1)

Button(window, text='Quit', command=window.quit).grid(row=3, column=0, sticky=E, pady=4)
Button(window, text='Show',command=codename).grid(row=3, column=1, pady=4)

def codename(self):
e1 = s1[:1]
if e == "a":
firstcodename = "Spring"
elif e == "b":
firstcodename = "Spring"
elif e == "c":
firstcodename = "Spring"
elif e == "d":
firstcodename = "Spring"
elif e == "e":
firstcodename = "Spring"
elif e == "f":
firstcodename = "Spring"
elif e == "g":
firstcodename = "Summer"
elif e == "h":
firstcodename = "Summer"
elif e == "i":
firstcodename = "Summer"
elif e == "j":
firstcodename = "Summer"
elif e == "k":
firstcodename = "Summer"
elif e == "l":
firstcodename = "Summer"
elif e == "m":
firstcodename = "Summer"
elif e == "n":
firstcodename = "Autumn"
elif e == "o":
firstcodename = "Autumn"
elif e == "p":
firstcodename = "Autumn"
elif e == "q":
firstcodename = "Autumn"
elif e == "r":
firstcodename = "Autumn"
else:
firstcodename = "Winter"

e2= s2[:1]
if e == "a":
lastcodename = "Thunder"
elif e == "b":
lastcodename = "Thunder"
elif e == "c":
lastcodename = "Thunder"
elif e == "d":
lastcodename = "Thunder"
elif e == "e":
lastcodename = "Thunder"
elif e == "f":
lastcodename = "Thunder"
elif e == "g":
lastcodename = "Shadow"
elif e == "h":
lastcodename = "Shadow"
elif e == "i":
lastcodename = "Shadow"
elif e == "j":
lastcodename = "Shadow"
elif e == "k":
lastcodename = "Shadow"
elif e == "l":
lastcodename = "Shadow"
elif e == "m":
lastcodename = "Shadow"
elif e == "n":
lastcodename = "Flash"
elif e == "o":
lastcodename = "Flash"
elif e == "p":
lastcodename = "Flash"
elif e == "q":
lastcodename = "Flash"
elif e == "r":
lastcodename = "Flash"
else:
lastcodename = "Terminator"

genderOption = gender
if genderOption == "male":
gender = "Mr. "
else:
gender = "Mrs. "

print(get.gender)
print(get.firstcodename)
print(get.lastcodename)

CodeNameProgram()






python user-interface tkinter radio-button






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 17:29









lizziefawley

1




1











  • Welcome to SO, please note that '. I'm struggling to make the codename function work' is not a specific enough question for this site. Try to describe your problem more accurately. If you get an error, include the complete traceback in your message. If you don't get the expected output, include the output you get vs the expected one. As a side note: you could rewrite your conditions if 'a' <= e <= 'f': ...
    – Thierry Lathuille
    Nov 11 at 17:46
















  • Welcome to SO, please note that '. I'm struggling to make the codename function work' is not a specific enough question for this site. Try to describe your problem more accurately. If you get an error, include the complete traceback in your message. If you don't get the expected output, include the output you get vs the expected one. As a side note: you could rewrite your conditions if 'a' <= e <= 'f': ...
    – Thierry Lathuille
    Nov 11 at 17:46















Welcome to SO, please note that '. I'm struggling to make the codename function work' is not a specific enough question for this site. Try to describe your problem more accurately. If you get an error, include the complete traceback in your message. If you don't get the expected output, include the output you get vs the expected one. As a side note: you could rewrite your conditions if 'a' <= e <= 'f': ...
– Thierry Lathuille
Nov 11 at 17:46




Welcome to SO, please note that '. I'm struggling to make the codename function work' is not a specific enough question for this site. Try to describe your problem more accurately. If you get an error, include the complete traceback in your message. If you don't get the expected output, include the output you get vs the expected one. As a side note: you could rewrite your conditions if 'a' <= e <= 'f': ...
– Thierry Lathuille
Nov 11 at 17:46

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251335%2fi-dont-know-why-my-python-gui-code-name-program-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251335%2fi-dont-know-why-my-python-gui-code-name-program-doesnt-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党