[Csnd] CsoundQt examples 2: widget generation
Date | 2012-01-12 13:24 |
From | Tarmo Johannes |
Subject | [Csnd] CsoundQt examples 2: widget generation |
I go on with some examples how to profit from CsoundQt python features. In last post I wrote a bit on generating the score. Python interpreter can help also with creation of widgets. See "Python Scripting in Csound" by Andrés Cabrera http://www.incontri.hmtm-hannover.de/fileadmin/www.incontri/Csound_Conference/Cabrera.pdf Widgets for closer information there is a number of methods like q.createNewLabel(int x, int y, int index = -1) Suppose you need to create 9 sliders in 3 rows with equal spacing. You could write to scratchpad: x0=10 y0=10 vspace=50 hspace=120 for row in range(0,3): for column in range(0,3): q.createNewSlider(x0+column*vspace, y0+row*hspace) and press "Evaluate selection" in the context menu of the scratchpad. Every time a new widget is created, a dialog opens where you can specify the properties of the widget. I would be happy to create the widgets completely automatically, giving the channel name (like "harmonic1", harmonic2" etc) and possibly also other parameters automatically from the script, but now it is not possible yet (I think). At least there could be an option to add the channel name with the parameters of createNewSlider and other widgets that have a channel, so that I could later use it with setWidgetProperty(channel, property, value, index= -1) Now createNew.. returns uuid of the widget, and not the channel name. In the same time setWidgetProperty needs the channel name and how would the script know what it is? (or createNew could return also the channel name). But still, it can be more convenient than copying, draging aligning the widgets. Hope it turns useful to someone. greetings, tarmo |