Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- # Call Tkinter by variable Window
- window = Tk()
- #Functions
- def end():
- exit()
- def click():
- entered_text=textbx.get()
- output.delete(0.0, END)
- try:
- definition = dicton[entered_text]
- except:
- definition = "Sorry this isn't in diction"
- output.insert(END, definition)
- #Window code
- window.title = "GUI"
- window.geometry("700x600")
- window.configure(background="black")
- #Basic Labels
- Label (window, bg="black", fg="white" , text="Enter text here:", font="none 10 bold") .grid(row=0, column=0,)
- Label (window, text="\nOutput:", bg="black", fg="white") .grid(row=2 , column=1)
- #Placement Items
- textbx = Entry(window, width="20", bg="white")
- textbx.grid(row=0, column=1, sticky=E)
- Button(window, width=6, text="Go!", command=click) .grid(row=1, column=1)
- output = Text(window, width=75, height=6, wrap=WORD, background="white" )
- output.grid(row=5, column=0, columnspan=10, sticky=W)
- #Dictionary for testing
- dicton = {
- 'bug': 'this is an error in code', 'software': 'This is something that isnt physical in IT'
- }
- Button(window, width=20, command=end,text="EXIT", bg="white" ) .grid(row=10, column=2)
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement