starting from the ofelia sysgui example i tried to find out which tcl tk commands i can send to pd.
i think basically it can do the same as the [sys_gui] object from the hcs library or the tcl-plugins.
i liked the possibility to load images but it seems not possible to load them in a gop, and they dissapear after their window is closed (like with text and shapes too).
Also changing the font is quite buggy
ofelia_sys_gui.zip
-
ofelia sys_gui
-
@whale-av I wonder if it would be possible to access all (or some) of the options from your vanilla-colours-plugin with ofelia?
https://forum.pdpatchrepo.info/topic/9960/tcl-for-a-rainy-day/23
and I also wonder if it is possible to implement a mouse plug-in i made some time ago.
my first attempt does not work. (not that it is really necessary)
this is the code from the mouse plug-in:bind all <Motion> {pdsend "mouse_receive $focused_window motion %x %y"} bind all <ButtonRelease-1> {pdsend "mouse_receive $focused_window mouseup %x %y"} bind all <ButtonPress-1> {pdsend "mouse_receive $focused_window mousedown %x %y"} bind all <FocusIn> {pdsend "mouse_receive $focused_window"} pdtk_post "loaded: experimental mouse plugin\n"```
-
most of the vanilla-colours-plugin options do also work with ofelia:
test.pd
-
@Jona So a lot can be done through sys:gui.
I had always thought scripting was limited because curly brackets could not be sent from Pd..... so is the ophelia sys-gui translating curved brackets?
And will the old [sys_gui] do the same?I don't think the bind command can be made post start-up....... although Pd doesn't complain it doesn't seem to take effect......... https://puredata.info/docs/developer/PdStartupOrder
I just fell on this........... https://forum.pdpatchrepo.info/topic/7498/tk-widgets-tcl-to-sys-_gui
I had some success with making and opening pop-up widgets using a -plugin, but the patch from the OP looks much like the scripting in ofelia_sys_gui.zip.
It goes a little way to being able to make a catch-all script that could be fed parameters.In the widget demo included in vanilla since 0.46.7 you have an example that places pictures in tk widgets.
It needs some of the scripting from the demo script, or it needs to be modified to work without the demo script running.A pop-ed up widget takes control from the Pd GUI. You need to be careful that you catch any mistaken closure by the window-close button or Pd loses contact with wish, hangs and cannot be closed.
The demo scripts contain the catch.
David. -
@whale-av so it seems its not possible to use bind commands after startup. i can run the demo scripts with the tk console, i will have a look.
here i found how to open a colorpicker:
colorpicker.pd
does anybody know how to return the choosen values? -
@Jona
Here is a fun plugin that I made years ago.
pd_choose_color-plugin.tcl
The palette chooser sets the variable $woof.
You should be able to send the variable $woof (the chosen colour in Hex format) to a receive object using pdsend instead of to the pdwindow as is the case in this plugin.
You would need to do some math to get the rgb values.
It seems I will have to install Ofelia.
David -
colorpanelAndMouse.pd
@whale-av now you can choose colors with the colorpanel in the patch. I found and implemented a small lua script that converts hex to rgb values.function ofelia.symbol(hex); local hex = hex:gsub("#", ""); local rgb = {}; rgb[1] = tonumber("0x"..hex:sub(1, 2)); rgb[2] = tonumber("0x"..hex:sub(3, 4)); rgb[3] = tonumber("0x"..hex:sub(5, 6)); return rgb; end;
or
function ofelia.symbol(hex); local hex = hex:gsub("#", ""); local r = -65536*(tonumber("0x"..hex:sub(1, 2))); local g = -256*(tonumber("0x"..hex:sub(3, 4))); local b = -1*(tonumber("0x"..hex:sub(5, 6))); local rgb = r+g+b; return rgb; end;
it is also possible to use the bind command (see [pd mouseExample]), but somehow not to get x and y mouse coordinates with %x and %y. perhaps that is still because of the pure data startup order.
edit: just realized that sys:gui is now pdSysGui in the new ofelia version (2.3). it is now also usable as an abstraction [pdSysGui]. adapting the patches is quite easy (but without they do not work anymore), here is the updated patch from above:
colorpanelAndMouse2b.pd