LoginSignup
1
1

備忘録(Python)

Last updated at Posted at 2024-04-22

Entry内の文字をクリックされたら消す

import tkinter

def focus(ev):
    e.delete(0, tkinter.END)

root = tkinter.Tk()
e = tkinter.Entry(root)
e.insert(tkinter.END,"注文数を入力")
e.pack()
e.bind("<Button-1>", focus)
#e.bind("KeyPress-F10")
root.mainloop()

insertした文字列をマウスで左クリックされたら消す。

tkinter_bind_sample.gif

参考にしました↓
https://teratail.com/questions/323007

GIFうるさくてごめん;;

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1