Python entry box ⌨️
HTML-код
- Опубликовано: 21 сен 2020
- Python entry box widget tkinter GUI code example tutorial beginners
#Python #entry #box #widget #tkinter #GUI #code #example #tutorial #beginners
from tkinter import *
#entry widget = textbox that accepts a single line of user input
def submit():
username = entry.get()
print("Hello "+username)
def delete():
entry.delete(0,END)
def backspace():
entry.delete(len(entry.get())-1, END)
window = Tk()
entry = Entry(window,
font=("Arial",50),
fg="#00FF00",
bg="black")
#entry.insert(0,'Spongebob')
#entry.config(show="*")
#entry.config(state=DISABLED)
entry.pack(side=LEFT)
submit_button = Button(window,text="submit",command=submit)
submit_button.pack(side=RIGHT)
delete_button = Button(window,text="delete",command=delete)
delete_button.pack(side=RIGHT)
backspace_button = Button(window,text="backspace",command=backspace)
backspace_button.pack(side=RIGHT)
window.mainloop() Наука
def display():
if(x.get()):
print("I like Python")
else:
print("I don't like Python")
window = Tk()
x = IntVar()
python_photo = PhotoImage(file="Python.png")
checkbox = Checkbutton(window,
text='Python',
variable=x,
onvalue=True,
offvalue=False,
command=display,
font=('Arial',20),
fg='#00FF00',
bg='#000000',
activeforeground='#0000FF',
activebackground='#000000',
padx=25,
pady=10,
width=200,
height=50,
anchor='w',
image=python_photo,
compound='left')
checkbox.pack()
window.mainloop()
is this from the checkbox video?
# for those who's finding the real code
# 70 entry box
from tkinter import *
def submit():
username = entry.get()
print("Hello "+username)
def delete():
entry.delete(0,END)
def backspace():
entry.delete(len(entry.get())-1, END)
window = Tk()
entry = Entry(window,
font=("Arial",50),
fg="#00FF00",
bg="black")
#entry.insert(0,'Spongebob')
#entry.config(show="*")
#entry.config(state=DISABLED)
entry.pack(side=LEFT)
submit_button = Button(window,text="submit",command=submit)
submit_button.pack(side=RIGHT)
delete_button = Button(window,text="delete",command=delete)
delete_button.pack(side=RIGHT)
backspace_button = Button(window,text="backspace",command=backspace)
backspace_button.pack(side=RIGHT)
window.mainloop()
# here :)
"Hello ergergergergergerg" 🤣
Bro, thank you for the great beginning of my day
very nice videos keep doing them bro
good video
Sorry for not watching videos yesterday bro. Continuing the grind today.
# For people trying to get this to work in the future use ."get" to get the contents of entry and the len() function to find the length of the string
def delete():
str_length = len(entry.get())
entry.delete(0, str_length)
# backspace is pretty much the same
def backspace():
str_length = len(entry.get())
entry.delete(str_length-1)
Great!
loved it!
Wow!
great staff. Was wondering if function delete and others can be made to be more universal so any entry connected to it would work properly...
cooool
Thank you!
Thanks
شكرا
groovy
3:23 😂
does .delete() take negative indexes like -1? if it takes, does .delete(-2,-1) have the same effect of the backspace?
wondering this as well! if anyone has a answer please do share
perfecto !!!
This is *****!
oops, left 'show="*"' on
This is great! Thank you!
I created multiple entry boxes but the backspace and delete keys affect all the boxes simultaneously.. How do I prevent? I want only the active box to be affected. Help.
amazing video
but the code you commented is for the next video not this one
Hahahahahahahaha the 3:23 🤣🤣🤣🤣🤣🤣
3:24 😂yes
thank you ergergegrgeregr, you're ergsome!
Hi dude, how I can change the color to a disabled entry box?
disabledbackground="grey"
Bro Code thanks bro ur number1
how to get int or float input from user?
Video 69/100
nice
My font never changes. I specified it to Arial.
drop a comment down delow
Window = Tk() does Not Work
What python version did you use
@@laopichthyrith2490 Sorry I'm Just Dumb I Figured It Out. It Wasn't Working Because I Did Not Install Tkinter😂