Assaf
2013-09-16 19:11:53 UTC
Hi there,
first of all I would like to thank all the people involved in writing and
supporting guidata. It's a wonderful tool, and very easy to use (I mean, if
I managed to use it, then it's probably very easy:))
I was trying to use guidata for writing a two level choice GUI. More
specifically, I want the GUI to include two choice items. The tricky bit is
that I want the second choice to depend on the first choice.
For example,
If the first choice is "0" then the second choice is "1" or "2".
If the first choice is "1" then the second choice is "3" or "4".
The example is described in the following code (that of course doesn't work.
):
from guidata.dataset.datatypes import DataSet
from guidata.dataset.dataitems import ChoiceItem
choice2Vec = [[(1,"1"),(2,"2")],[(3,"3"),(4,"4")]]
class guiclass(DataSet):
"""
trying to do a two level choice
"""
choice1 = ChoiceItem("first choice ",[(0, "0"), (1, "1")])
choice2 = ChoiceItem("second choice ",choice2Vec[choice1])
if __name__ == "__main__":
# Create QApplication
import guidata
_app = guidata.qapplication()
e = guiclass()
e.edit()
e.view()
My questions are:
1) How does the choice of the first item trigger the the configuration of
the second. There is an example in the reference of the "Data item groups
and group selection", in which two items enable/disable each other by using
"set_prop", but I didn't manage to extend it to my needs.
2) How do I change the choice item after the class was defined? As far as I
tried, I didn't manage to do it. After the class is instantiated, I didn't
manage to change the configuration. Refereing to e.choice1 gives an integer.
Thank you
Assaf
first of all I would like to thank all the people involved in writing and
supporting guidata. It's a wonderful tool, and very easy to use (I mean, if
I managed to use it, then it's probably very easy:))
I was trying to use guidata for writing a two level choice GUI. More
specifically, I want the GUI to include two choice items. The tricky bit is
that I want the second choice to depend on the first choice.
For example,
If the first choice is "0" then the second choice is "1" or "2".
If the first choice is "1" then the second choice is "3" or "4".
The example is described in the following code (that of course doesn't work.
):
from guidata.dataset.datatypes import DataSet
from guidata.dataset.dataitems import ChoiceItem
choice2Vec = [[(1,"1"),(2,"2")],[(3,"3"),(4,"4")]]
class guiclass(DataSet):
"""
trying to do a two level choice
"""
choice1 = ChoiceItem("first choice ",[(0, "0"), (1, "1")])
choice2 = ChoiceItem("second choice ",choice2Vec[choice1])
if __name__ == "__main__":
# Create QApplication
import guidata
_app = guidata.qapplication()
e = guiclass()
e.edit()
e.view()
My questions are:
1) How does the choice of the first item trigger the the configuration of
the second. There is an example in the reference of the "Data item groups
and group selection", in which two items enable/disable each other by using
"set_prop", but I didn't manage to extend it to my needs.
2) How do I change the choice item after the class was defined? As far as I
tried, I didn't manage to do it. After the class is instantiated, I didn't
manage to change the configuration. Refereing to e.choice1 gives an integer.
Thank you
Assaf
--
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "guidata/guiqwt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guidata_guiqwt+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.