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()
  • НаукаНаука

Комментарии • 37

  • @BroCodez
    @BroCodez  3 года назад +9

    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()

    • @kosolomon123
      @kosolomon123 2 года назад +4

      is this from the checkbox video?

    • @Gokeniz7
      @Gokeniz7 3 месяца назад

      # 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 :)

  • @liudmilarodzina8084
    @liudmilarodzina8084 2 года назад +4

    "Hello ergergergergergerg" 🤣
    Bro, thank you for the great beginning of my day

  • @plastic-_-bag1826
    @plastic-_-bag1826 Год назад

    very nice videos keep doing them bro

  • @uuhju7004
    @uuhju7004 3 года назад +1

    good video

  • @lw9954
    @lw9954 Год назад +3

    Sorry for not watching videos yesterday bro. Continuing the grind today.

  • @PUR3lCHA0S
    @PUR3lCHA0S Год назад +1

    # 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)

  • @truquichan
    @truquichan 10 месяцев назад

    Great!

  • @alphad9474
    @alphad9474 2 года назад

    loved it!

  • @beingzero7541
    @beingzero7541 2 года назад

    Wow!

  • @michael3k80
    @michael3k80 2 года назад

    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...

  • @kristijanlazarev
    @kristijanlazarev 5 месяцев назад

    cooool

  • @SuperStarEevee
    @SuperStarEevee Год назад

    Thank you!

  • @rubenc4696
    @rubenc4696 2 месяца назад

    Thanks

  • @EissaAlahdul
    @EissaAlahdul Год назад +1

    شكرا

  • @jhassee
    @jhassee Год назад

    groovy

  • @philtoa334
    @philtoa334 3 года назад +3

    3:23 😂

  • @arkamukhopadhyay2177
    @arkamukhopadhyay2177 3 года назад +1

    does .delete() take negative indexes like -1? if it takes, does .delete(-2,-1) have the same effect of the backspace?

    • @onlyLewds
      @onlyLewds 2 года назад

      wondering this as well! if anyone has a answer please do share

  • @piotrkopcewicz5227
    @piotrkopcewicz5227 Год назад

    perfecto !!!

  • @creator6714
    @creator6714 5 месяцев назад

    This is *****!
    oops, left 'show="*"' on
    This is great! Thank you!

  • @captain_ali_01
    @captain_ali_01 2 года назад

    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.

  • @arshamcfr3236
    @arshamcfr3236 Год назад +2

    amazing video
    but the code you commented is for the next video not this one

  • @Amir_Plays_non_stop
    @Amir_Plays_non_stop 3 года назад +1

    Hahahahahahahaha the 3:23 🤣🤣🤣🤣🤣🤣

  • @VenkiTotad
    @VenkiTotad Год назад

    3:24 😂yes

  • @thrasherbassboy
    @thrasherbassboy 2 года назад +1

    thank you ergergegrgeregr, you're ergsome!

  • @vdafs1
    @vdafs1 3 года назад +2

    Hi dude, how I can change the color to a disabled entry box?

    • @BroCodez
      @BroCodez  3 года назад +6

      disabledbackground="grey"

    • @vdafs1
      @vdafs1 3 года назад +3

      Bro Code thanks bro ur number1

  • @anonymoushelp9740
    @anonymoushelp9740 Месяц назад

    how to get int or float input from user?

  • @MrEicke01
    @MrEicke01 2 года назад

    Video 69/100
    nice

  • @omairtech6711
    @omairtech6711 Год назад

    My font never changes. I specified it to Arial.

  • @Adamelamine
    @Adamelamine 2 года назад

    drop a comment down delow

  • @scpf2360
    @scpf2360 2 года назад +3

    Window = Tk() does Not Work

    • @laopichthyrith2490
      @laopichthyrith2490 Год назад +1

      What python version did you use

    • @scpf2360
      @scpf2360 Год назад +1

      @@laopichthyrith2490 Sorry I'm Just Dumb I Figured It Out. It Wasn't Working Because I Did Not Install Tkinter😂