May-18-2020, 03:37 PM
Dear python Community, I am having a hard time trying to figure out how to print the result in the app for my silly sentence generator. I was able to write the app and have the generate the silly sentences without using tkinter. However, I cannot seem to figure out how to get it to work with the GUI. I've done a lot of research and I have looked through the Forum, but I've had no luck figuring it out. Here is the code. I have a lot to learn with tkinter yet. As of right now, I get no error. Nothing pops up at all on the app.
import random import names from tkinter import * window = Tk() window.title('Silly Sentence Generator') window.geometry('500x500') #names.get_full_name() #names.get_full_name(gender='male') #names.get_first_name() #names.get_first_name(gender='female') #names.get_last_name() first = (names.get_first_name()) second = ("likes", "wants", "prefers" ) third = ("a hamburger", "a roast beef sandwich", "chicken tenders") def sentencegen(): firrst = (first) seccond = random.choice(second) thirrd = random.choice(third) def phrase(): phrase = ((firrst) + " " + (seccond) + " " + (thirrd) + ".") ssg = Button(text='Generate', command=sentencegen) ssg.pack() result=phrase window.mainloop()