Learn Python tkinter GUI user input easy ⌨️

preview_player
Показать описание
You guys don't need all the config() calls, you can place them within the constructor if you want. I like to add comments line-by-line for teaching purposes to help explain. Do what works for you.

Python Tkinter GUI entry widget for user input tutorial for beginners

# entry widget = textbox that accepts a single line of user input

from tkinter import *

def submit():
print("Hello "+username)

def delete():

def backspace():

window = Tk()
label = Label(window,text="username: ")

submit = Button(window,text="submit",command=submit)

delete = Button(window,text="delete",command=delete)

backspace = Button(window,text="backspace",command=backspace)

entry = Entry()

Coding boot camps hate him! See how he can teach you to code with this one simple trick...

Bro Code is the self-proclaimed #1 tutorial series on coding in the known universe.
Рекомендации по теме
Комментарии
Автор

# entry widget = textbox that accepts a single line of user input

from tkinter import *

def submit():
username = entry.get() #gets entry text
print("Hello "+username)

def delete():
entry.delete(0, END) #deletes the line of text

def backspace():
entry.delete(len(entry.get())-1, END) #delete last character

window = Tk()
window.title("user input")
label = Label(window, text="username: ")
label.config(font=("Consolas", 30))
label.pack(side=LEFT)

submit = Button(window, text="submit", command=submit)
submit.pack(side = RIGHT)

delete = Button(window, text="delete", command=delete)
delete.pack(side = RIGHT)

backspace = Button(window, text="backspace", command=backspace)
backspace.pack(side = RIGHT)

entry = Entry()
entry.config(font=('Ink Free', 50)) #change font
#background
entry.config(fg='#00FF00') #foreground
entry.config(width=10) #width displayed in characters
#entry.insert(0, 'Spongebob') #set default text
#entry.config(state=DISABLED) #ACTIVE/DISABLED
#entry.config(show='*') #replace characters shown with x character
entry.pack()
window.mainloop()

BroCodez
Автор

clear, easy to understand and very useful tutorial. Great!

surferkwsurferkw
Автор

Ok. your video, helped me...
Thankfull

akuncoba
Автор

Thank you my brother i from iraq i abaric
you helo me now thank you
i like you and i Subscribe to your channel

lw_w
Автор

How would I get multiple user data entry inputs and display those inputs on a separate text line? Maybe even type out simultaneously on that separate line as well, in GUI format?
Thanks. Your vids are great!!!

mikemurphy
Автор

super! is there a way to also show py console output in a ttk widget?

econtutor
Автор

This feels me like gigachad is behind pc lol

YouGotCAGEDyt
Автор

The name of the porgram you imagined by video

fnxpmke
Автор

Is there any way that I can add some text with the entry widget for user to know what to enter? like a placeholder or something

vedant__kadu
Автор

do you have videos about padX and padY?

NameEnter-njcx
Автор

Can we make a backspace command on label

leum
Автор

TypeError: expected string or bytes-like object, got 'dict'

No-t-h-i-n-g
Автор

I get an error that can't invoke "button" command: Application has been destoryed

XMegaJuni