Using tkinter to replicate a symbol within an entry box (approaches to rendering a custom caret cursor in an entry box)

I’m having quite a challenge trying to replicate an image within an entry box (see below)

The general prose is that I’d like to be able to change the blinking caret in an entry box to a different image / ASCII-Unicode symbol.

Could anyone give me a hand?

Simple (Code);

I’ve tried approaching this problem already using this script here;

import tkinter as tk
from tkinter import *
from PIL import ImageTk, Image
import os

# root
root=tk.Tk()

# constants
MAX_CHARS = 16
FONT_SIZE = 8
FONT="TkFixedFont"
COLOR="green2"

SCREEN_WIDTH = MAX_CHARS * FONT_SIZE * 2
SCREEN_HEIGHT = 200

# adjust window size
root.geometry(str(SCREEN_WIDTH)+"x"+str(SCREEN_HEIGHT))
root.minsize(SCREEN_WIDTH, SCREEN_HEIGHT)
root.maxsize(SCREEN_WIDTH, SCREEN_HEIGHT)

# console input
root.columnconfigure(1, weight=1, minsize=1)
root.columnconfigure(2, weight=0, minsize=1)
root.rowconfigure(1, weight=1, minsize=1)

# process input
def process(sv):
    print('_n⬤n' + sv.get())

# update widget
def update(event, widget, sv, max):
    # get stringvar
    t = sv.get()

    # get amount of letter
    l = len(t)
        
    # limit max letter
    if l > max: sv.set(t[1:])

    # process input on enter keypress
    if (event.keysym == "Return"): process(sv)

# set background
frame = tk.Frame(root, bg='black')
frame.place(relwidth=1, relheight=1)

# create label
lt = '_n⬤'

label = Label(
    root,
    bg="black",
    fg=COLOR,

    highlightthickness=0, 
    borderwidth=0,

    text=lt,
    font=FONT
)

label.grid(row=2, column=0, sticky=SW)

# create listbox object
sv = StringVar()

entry = Entry(
    root,
    bg="black",
    fg=COLOR,

    highlightthickness=0, 
    borderwidth=0,
    
    width=MAX_CHARS,

    textvariable=sv,
    insertontime = 0,
    insertwidth=0,

    font=FONT
)

entry.grid(row=2, column=1, sticky=SW)  
entry.bind('<KeyRelease>', lambda e: update(e, entry, sv, MAX_CHARS))

# main loop
root.mainloop()

Basically all this does is shoves a label before an entry box and puts the “⬤” ascii beneath an “_” ascii with some additional extras (easy right?).

aaaaand whilst it does the job i want to a degree I’d like to add some flare or pisazz if you will. (what’s a project without a lil’ challenge ay’?)

Question(s) / Approach(es);

  • (OPT 1) Can i change the caret image (“the blinking cursor” as it’s been described) in the entry box to an image or something resembling an over-score ( ̅ ) using tkinter?
    • This would mean i could edit the label if the user types, remove the “fake over-score” and have it displayed above the cursors current position
      (1. ̅● The quick brow –> 2. ● The quick br ̅o)
  • (OPT 2) Can i change the caret image to the terminal cursor image? ( ̅●)
    • (1. ̅● Hello! –> 2. He ̅●llo!)
  • (OPT 3) Can i move the label over the entry box?
    • (I would think this would be laggy and not very compatible with older machines but for sake of argument this is what it would look like 1. [ ̅●] Nonono –> 2. Non[ ̅●]ono)
  • Can i fix the over-scores rendering issues somehow or should i use an image? ( ̅● <– notice how it displays to the left or right of a character not over the top or middle, and it isn’t “thick” enough and leaves an unwanted space)
  • Do you recommend any other modules in python and approaches to this problem? (PYQT5?)

Extras;

As i want this to be portable to a RP-PI2(B+) (I’m probably going to use a different board later but this is just a demo for proof of concept) keep in mind that I’d like to avoid directly modifying the tkinters file for the caret image and find a more code-based solution but i welcome any answers regarding this still! It’s probably also worth noting I’m going to be trying to embed this GUI to replace the default RP-PI’s terminal at bootup)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật