-
Hi Marco!! Cheers |
Beta Was this translation helpful? Give feedback.
Answered by
marcomusy
Jun 15, 2022
Replies: 1 comment 1 reply
-
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"],
bc=["dg"], # colors of states
font="courier", # arial, courier, times
size=40,
bold=True,
italic=False,
)
mesh = Mesh(dataurl+"magnolia.vtk").c("v").flat()
plt.show(mesh).close() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jkissi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Interesting question... This is a bit hacky but you can experiment with it: