Skip to content

Question on data input #659

Answered by marcomusy
jkissi asked this question in Q&A
Jun 15, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi! Interesting question... This is a bit hacky but you can experiment with it:

from vedo import *

settings.enableDefaultKeyboardCallbacks = False

def kfunc(evt):
    global msg
    evt.keyPressed = evt.keyPressed.replace("period", ".")
    if evt.keyPressed == "BackSpace":
        msg = msg[:-1]
    else:
        msg += f"{evt.keyPressed}"
    bu.actor.SetInput(msg)
    plt.render()

def bfunc():
    print("do something")


plt = Plotter(axes=1)
plt.interactor.RemoveObservers("CharEvent") # might be needed

msg = ""
plt.addCallback("key press", kfunc)

bu = plt.addButton(
    bfunc,
    pos=(0.7, 0.05),  # x,y fraction from bottom left corner
    states=["input value here"],
    c=["w"]…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jkissi
Comment options

Answer selected by jkissi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants