Misplaced Pages

Code

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an old revision of this page, as edited by 210.55.88.11 (talk) at 23:37, 22 June 2021 (yur). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 23:37, 22 June 2021 by 210.55.88.11 (talk) (yur)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

] messages were the state of the art in rapid long-distance communication, elaborate systems of [[co

  1. my glossary project#

from tkinter import *

  1. key down function

def click():

   entered_text=textentry.get() #this will collect the text form the text entry box
   output.delete(0.0, END)
   try:
       definition = my_compdictionary
   except:
       definition = "sorry there is no word like that please try again"
   output.insert(END, definition)
        1. main:

window = Tk() window.title("My computer Science Glassary") window.configure(background="black")

        1. My photo

photo1 = PhotoImage(file="me.gif") Label (window, image=photo1, bg="black") .grid(row=0, column=0, sticky=E)

  1. create label

Label (window, text="Enter the word you would a definition for:", bg="black", fg="white", font="none 12 bold") .grid(row=1, column=0, sticky=W)

  1. create a text entry box

textentry = Entry(window, width=20, bg="white") textentry.grid(row=2, column=0, sticky=W)

  1. add a submit button

Button(window, text="SUBMIT", width=6, comman=click) . grid(row=3, column=0, sticky=W)

  1. create another label

Label (window, text="\nDefiniition:", bg="black", fg="white", font="none 12 bold") .grid(row=4, column=0, sticky=W)

  1. create a text box

output = Text(window, width=75, height=6, wrap=WORD, background="white") output.grid(row=5, column=0, columnspan=2, sticky=W)

  1. the dictionary

my_compdictionary = {

   'algorithm': 'Step by step instruction to complete a task', 'bug': 'piece of code causes a program to fail'
   }
  1. exit label

Label (window, text="click to exit:", bg="black", fg="white", font="none 12 bold") .grid(row=6, column=0, sticky=W)

  1. exit function

def close_window():

   window.destroy()
   exit()
  1. add exit button

Button(window, text="Exit", width=14, comman=close_window) . grid(row=7, column=0, sticky=W)

        1. run the main loop

window.mainloop()#my glossary project#

from tkinter import *

  1. key down function

def click():

   entered_text=textentry.get() #this will collect the text form the text entry box
   output.delete(0.0, END)
   try:
       definition = my_compdictionary
   except:
       definition = "sorry there is no word like that please try again"
   output.insert(END, definition)
        1. main:

window = Tk() window.title("My computer Science Glassary") window.configure(background="black")

        1. My photo

photo1 = PhotoImage(file="me.gif") Label (window, image=photo1, bg="black") .grid(row=0, column=0, sticky=E)

  1. create label

Label (window, text="Enter the word you would a definition for:", bg="black", fg="white", font="none 12 bold") .grid(row=1, column=0, sticky=W)

  1. create a text entry box

textentry = Entry(window, width=20, bg="white") textentry.grid(row=2, column=0, sticky=W)

  1. add a submit button

Button(window, text="SUBMIT", width=6, comman=click) . grid(row=3, column=0, sticky=W)

  1. create another label

Label (window, text="\nDefiniition:", bg="black", fg="white", font="none 12 bold") .grid(row=4, column=0, sticky=W)

  1. create a text box

output = Text(window, width=75, height=6, wrap=WORD, background="white") output.grid(row=5, column=0, columnspan=2, sticky=W)

  1. the dictionary

my_compdictionary = {

   'algorithm': 'Step by step instruction to complete a task', 'bug': 'piece of code causes a program to fail'
   }
  1. exit label

Label (window, text="click to exit:", bg="black", fg="white", font="none 12 bold") .grid(row=6, column=0, sticky=W)

  1. exit function

def close_window():

   window.destroy()
   exit()
  1. add exit button

Button(window, text="Exit", width=14, comman=close_window) . grid(row=7, column=0, sticky=W)

        1. run the main loop

window.mainloop()