File: textbox_cursor.py

package info (click to toggle)
python-guizero 1.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,828 kB
  • sloc: python: 6,744; makefile: 28; sh: 17
file content (14 lines) | stat: -rw-r--r-- 360 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from guizero import App, TextBox, Text
from tkinter import INSERT

def key_pressed(key):
    details.value = "key pressed = {}, cursor pos = {}".format(
        textbox.value, 
        textbox.cursor_position
        )

app = App()
text = Text(app, text="Enter some text")
textbox = TextBox(app, width=40, command=key_pressed)
details = Text(app)
app.display()