I am trying to make a simple sentence generator. The code works but I just want to know if there are any ways to expand the GUI entry box?
This is how it looks like:
Any help would be appreciated.
import tkinter as tk from tkinter import Entry import random window = tk.Tk() def movingVerb(): verbs = ["goes to", "walks through", "runs through"] moveVerb = random.choice(verbs) return moveVerb def anObject(): anObject = objectEntry.get() def Generate(): UserName = nameEntry.get() moveVerb = movingVerb() place = placeEntry.get() noun = objectEntry.get() sentence = UserName + " " + moveVerb + " a " + place + " and finds a " + noun + " ." result.delete(0, tk.END) result.insert(0, sentence) UserNameLabel = tk.Label(window, text="Enter a name: ") nameEntry = tk.Entry(window) anObjectLabel = tk.Label(window,text="Enter an object: ") objectEntry = tk.Entry(window) placeLabel = tk.Label(window, text="Enter a place: ") placeEntry = tk.Entry(window) button = tk.Button(window, text="Generate story", command=Generate) result = tk.Entry(window) UserNameLabel.pack() nameEntry.pack() anObjectLabel.pack() objectEntry.pack() placeLabel.pack() placeEntry.pack() button.pack() result.pack() window.mainloop()