Can anyone help me print this simple function to a text box instead of the shell?
>>>
Like this?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from tkinter import * root = Tk() root.geometry( "800x800" ) def retrieve_input(): inputValue = textBox.get( "1.0" , "end-1c" ) if inputValue = = "password" : print ( "ok" ) else : print ( "no" ) textBox = Text(root, height = 20 , width = 30 ) textBox.pack() buttonCommit = Button(root, height = 1 , width = 10 , text = "Commit" , command = lambda :retrieve_input()) buttonCommit.pack() mainloop() |
Like this?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from tkinter import * root = Tk() root.geometry( "800x800" ) def retrieve_input(): inputValue = textBox.get( "1.0" , "end-1c" ) if inputValue = = "password" : print ( "fff" ) else : print ( "got em" ) textBox = Text(root, height = 20 , width = 30 ) textBox.pack() buttonCommit = Button(root, height = 1 , width = 10 , text = "Commit" , command = lambda :retrieve_input()) buttonCommit.pack() mainloop() |