This is a question related to compas_view2 method.
Is there any possibility to print the name of a currently clicked button in the compas_view2 method?
In the click method I would like to print this property: text=“Reset”.
@viewer.button(text="Reset")
def click():
if viewer.confirm('This will reset the point to parameter t=0.'):
pointobj._data = curve.point(0)
pointobj.update()
slide.value = 0
viewer.view.update()
If I pass two variables in the click function I get what I want e.g. click(number0 = i, number1 = 1).
If I just pass one variable click(number0 = i,). this will always return boolean false.
the button decorator basically replaces the function by a UI object.
so, in this case, you can just do click.button.text() to get the text value of the button…
@viewer.button(text="Reset")
def click():
if viewer.confirm('This will reset the point to parameter t=0.'):
pointobj._data = curve.point(0)
pointobj.update()
slide.value = 0
viewer.view.update()
print(click.button.text())
I created a little bit more buttons than the viewer panel can store by default.
In this situation it is possible to expand the panel by hovering with the mouse on the bottom.
Is there any way to see all buttons at once without automatic collapsing?
Because once I move my mouse outside the panel collapse back again.
I also thought the same.
But I have a case when I am developing the library. And at one moment I need to test more than 40 data-sets, including bad user inputs, to know if it crashes and where are possible mistakes. So I test them all one by one via viewer.
sure, but this could still be some kind of selection menu with all possible options and a “load” button for the selected option, or something like that, no?
Thank you.
For dev updates, which I imagine this is not on conda yet, is it enough to pip install like this in a current environment to update the current package?
in general, easiest is to install from conda in some environment to get all the dependencies right and then indeed do a pip install from local source or directly from github to get the latest stuff.
that said though, we are in the process of switching to qtpy (https://github.com/spyder-ide/qtpy) to maximize compatibility with multiple backends, and parts of the dev version of compas_view2 use unreleased components of compas. so you have to install qtpy in your environment and the latest dev version of compas. so with your env activated…