Hey Jonathan,
I'm cc'ing pd-dev since this is a topic that could interest others and others could contribute to. I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. The idea is to try out a new idea for how GUI objects can work. Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui <--> pd communications, and making it easier to write GUI objects. Its not trivial to do, but should be doable.
.hc
On Aug 17, 2011, at 12:26 PM, Jonathan Wilkes wrote:
Never mind, I see it now inside canvas_vis... too bad canvas' "window" subcommand doesn't have something like pack's "-in" option...
But I guess I could make a toplevel checkbutton widget and just manually clone it.
-Jonathan
From: Jonathan Wilkes jancsika@yahoo.com To: Hans- Christoph Steiner hans@at.or.at Sent: Wednesday, August 17, 2011 3:14 AM Subject: tkwidgets
Hi Hans, Do I have it right that your tkwidgets get destroyed when the containing patch is vis'd 0? If so, any hints on how this happens?
Specifically, I'm playing around with [checkbutton], and even if I comment out everything in eraseme and checkbutton_free, and every single "destroy" subcommand, I still get a tcl error when sending a bang or float to a [checkbutton] that's in a subpatch with no window mapped:
(Tcl) INVALID COMMAND NAME: invalid command name ".x252a690.c.widget25272b0" while executing ".x252a690.c.widget25272b0 cget -onvalue" ("uplevel" body line 2) invoked from within "uplevel #0 $cmd_from_pd"
----------------------------------------------------------------------------
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
How does your private git branch differ from what's currently in svn? One thing I'd like to point out is that your tkwidgets suffer from the same problem tot/widget did -- by handling all the widget state in tcl you make it impossible to use your objects inside a subpatch/abstraction that doesn't have a visible canvas (because the widget no longer exists). I was considering create a "master" widget as a child of the main window and sync it to the widget drawn on the canvas, but that seems like a lot of trouble. Is there some other workaround?
Another thing: to get "Pd-style" interaction, bind $canvas <<EditMode>> to a proc that sets -state to disabled for all tkwidgets in that $canvas when editmode == 1. That way you don't end up triggering the widget when you want to edit it.
-Jonathan
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-dev List pd-dev@iem.at Sent: Wednesday, August 17, 2011 2:54 PM Subject: Re: tkwidgets
Hey Jonathan,
I'm cc'ing pd-dev since this is a topic that could interest others and others could contribute to. I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. The idea is to try out a new idea for how GUI objects can work. Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui <--> pd communications, and making it easier to write GUI objects. Its not trivial to do, but should be doable.
.hc
On Aug 17, 2011, at 12:26 PM, Jonathan Wilkes wrote:
Never mind, I see it now inside canvas_vis... too bad canvas' "window" subcommand doesn't have something like pack's "-in" option...
But I guess I could make a toplevel checkbutton widget and just manually clone it.
-Jonathan
From: Jonathan Wilkes jancsika@yahoo.com To: Hans- Christoph Steiner hans@at.or.at Sent: Wednesday, August 17, 2011 3:14 AM Subject: tkwidgets
Hi Hans, Do I have it right that your tkwidgets get destroyed when the containing patch is vis'd 0? If so, any hints on how this happens?
Specifically, I'm playing around with [checkbutton], and even if I comment out everything in eraseme and checkbutton_free, and every single "destroy" subcommand, I still get a tcl error when sending a bang or float to a [checkbutton] that's in a subpatch with no window mapped:
(Tcl) INVALID COMMAND NAME: invalid command name ".x252a690.c.widget25272b0" while executing ".x252a690.c.widget25272b0 cget -onvalue" ("uplevel" body line 2) invoked from within "uplevel #0 $cmd_from_pd"
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
On Aug 17, 2011, at 6:23 PM, Jonathan Wilkes wrote:
How does your private git branch differ from what's currently in svn?
I pushed my git to github, my latest work is in the 'newentry' branch. I basically focused on the [entry] widget to see if I could get it going with this new approach.
https://github.com/pd-projects/tkwidgets
One thing I'd like to point out is that your tkwidgets suffer from the same problem tot/widget did -- by handling all the widget state in tcl you make it impossible to use your objects inside a subpatch/ abstraction that doesn't have a visible canvas (because the widget no longer exists). I was considering create a "master" widget as a child of the main window and sync it to the widget drawn on the canvas, but that seems like a lot of trouble. Is there some other workaround?
That is true, but tkwidgets are all about using Tk widgets in Pd as easily as possible. If the Tk widget is not drawn to the screen, then the Tk widget is not involved. What is the problem in particular? You want to change its state while its not visible? I think the idea there is to have the state stored in the standard struct as a dump from the Tk widget. So when its not visible, store the state-changes, when it becomes visible, dump the state to the Tk widget.
Another thing: to get "Pd-style" interaction, bind $canvas <<EditMode>> to a proc that sets -state to disabled for all tkwidgets in that $canvas when editmode == 1. That way you don't end up triggering the widget when you want to edit it.
Yeah, tkwidgets was mostly written about the same time as I starting the pd-gui-rewrite. As I rewrote a lot of pd-gui, I realized I should wait on tkwidgets since I could fix a lot of things in pd-gui first. The <<EditMode>> message is one example. tkwdigets is not complete yet, so this is not fully in there. I think the [entry] in github does this kind of stuff.
.hc
Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-dev List pd-dev@iem.at Sent: Wednesday, August 17, 2011 2:54 PM Subject: Re: tkwidgets
Hey Jonathan,
I'm cc'ing pd-dev since this is a topic that could interest others and others could contribute to. I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. The idea is to try out a new idea for how GUI objects can work. Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui <--> pd communications, and making it easier to write GUI objects. Its not trivial to do, but should be doable.
.hc
On Aug 17, 2011, at 12:26 PM, Jonathan Wilkes wrote:
Never mind, I see it now inside canvas_vis... too bad canvas' "window" subcommand doesn't have something like pack's "-in" option...
But I guess I could make a toplevel checkbutton widget and just manually clone it.
-Jonathan
From: Jonathan Wilkes jancsika@yahoo.com To: Hans- Christoph Steiner hans@at.or.at Sent: Wednesday, August 17, 2011 3:14 AM Subject: tkwidgets
Hi Hans, Do I have it right that your tkwidgets get destroyed when the containing patch is vis'd 0? If so, any hints on how this happens?
Specifically, I'm playing around with [checkbutton], and even if I comment out everything in eraseme and checkbutton_free, and every single "destroy" subcommand, I still get a tcl error when sending a bang or float to a [checkbutton] that's in a subpatch with no window mapped:
(Tcl) INVALID COMMAND NAME: invalid command name ".x252a690.c.widget25272b0" while executing ".x252a690.c.widget25272b0 cget -onvalue" ("uplevel" body line 2) invoked from within "uplevel #0 $cmd_from_pd"
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
----------------------------------------------------------------------------
"We have nothing to fear from love and commitment." - New York Senator Diane Savino, trying to convince the NY Senate to pass a gay marriage bill
The problem is for a subpatch that isn't vis'd:
[inlet] | [checkbutton] | [outlet]
Will give an error on "bang" because checkbutton_bang has: sys_vgui("%s invoke\n", x->widget_id->s_name);
That could be solved by using a -variable option, but then that limits you because the nonzero value cannot be changed.*
So yeah, the best solution is stored state in the struct so you can access it in the c functions without caring about the vis state of the obj. Is that the idea behind the options_binbuf?
* also note that checkbutton's default behavior is the opposite from tgl: tgl: zero = off, nonzero = on checkbutton: onvalue = on, everything else = off
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-dev List pd-dev@iem.at Sent: Wednesday, August 17, 2011 7:24 PM Subject: Re: tkwidgets
On Aug 17, 2011, at 6:23 PM, Jonathan Wilkes wrote:
How does your private git branch differ from what's currently in svn?
I pushed my git to github, my latest work is in the 'newentry' branch. I basically focused on the [entry] widget to see if I could get it going with this new approach.
https://github.com/pd-projects/tkwidgets
One thing I'd like to point out is that your tkwidgets suffer from the same problem tot/widget did -- by handling all the widget state in tcl you make it impossible to use your objects inside a subpatch/abstraction that doesn't have a visible canvas (because the widget no longer exists). I was considering create a "master" widget as a child of the main window and sync it to the widget drawn on the canvas, but that seems like a lot of trouble. Is there some other workaround?
That is true, but tkwidgets are all about using Tk widgets in Pd as easily as possible. If the Tk widget is not drawn to the screen, then the Tk widget is not involved. What is the problem in particular? You want to change its state while its not visible? I think the idea there is to have the state stored in the standard struct as a dump from the Tk widget. So when its not visible, store the state-changes, when it becomes visible, dump the state to the Tk widget.
Another thing: to get "Pd-style" interaction, bind $canvas <<EditMode>> to a proc that sets -state to disabled for all tkwidgets in that $canvas when editmode == 1. That way you don't end up triggering the widget when you want to edit it.
Yeah, tkwidgets was mostly written about the same time as I starting the pd-gui-rewrite. As I rewrote a lot of pd-gui, I realized I should wait on tkwidgets since I could fix a lot of things in pd-gui first. The <<EditMode>> message is one example. tkwdigets is not complete yet, so this is not fully in there. I think the [entry] in github does this kind of stuff.
.hc
Hans-Christoph Steiner hans@at.or.at
To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-dev List pd-dev@iem.at Sent: Wednesday, August 17, 2011 2:54 PM Subject: Re: tkwidgets
Hey Jonathan,
I'm cc'ing pd-dev since this is a topic that could interest others and others could contribute to. I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. The idea is to try out a new idea for how GUI objects can work. Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui <--> pd communications, and making it easier to write GUI objects. Its not trivial to do, but should be doable.
.hc
On Aug 17, 2011, at 12:26 PM, Jonathan Wilkes wrote:
Never mind, I see it now inside canvas_vis... too bad canvas' "window" subcommand doesn't have something like pack's "-in" option...
But I guess I could make a toplevel checkbutton widget and just manually clone it.
-Jonathan
From: Jonathan Wilkes jancsika@yahoo.com To: Hans- Christoph Steiner hans@at.or.at Sent: Wednesday, August 17, 2011 3:14 AM Subject: tkwidgets
Hi Hans, Do I have it right that your tkwidgets get destroyed when the containing patch is vis'd 0? If so, any hints on how this happens?
Specifically, I'm playing around with [checkbutton], and even if I comment out everything in eraseme and checkbutton_free, and every single "destroy" subcommand, I still get a tcl error when sending a bang or float to a [checkbutton] that's in a subpatch with no window mapped:
(Tcl) INVALID COMMAND NAME: invalid command name ".x252a690.c.widget25272b0" while executing ".x252a690.c.widget25272b0 cget -onvalue" ("uplevel" body line 2) invoked from within "uplevel #0 $cmd_from_pd"
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
"We have nothing to fear from love and commitment." - New York Senator Diane Savino, trying to convince the NY Senate to pass a gay marriage bill
On Aug 17, 2011, at 8:17 PM, Jonathan Wilkes wrote:
The problem is for a subpatch that isn't vis'd:
[inlet] | [checkbutton] | [outlet]
Will give an error on "bang" because checkbutton_bang has: sys_vgui("%s invoke\n", x->widget_id->s_name); That could be solved by using a -variable option, but then that limits you because the nonzero value cannot be changed.*
So yeah, the best solution is stored state in the struct so you can access it in the c functions without caring about the vis state of the obj. Is that the idea behind the options_binbuf?
Yeah, options_binbuf is related to dumping/setting the Tk configuration for the widget. Once the resizing, Tk configuration saving, interaction technique, etc. is settled, then we can nail down details like what needs to happen when the Tk widget does not exist but the object receives a message.
- also note that checkbutton's default behavior is the opposite from
tgl: tgl: zero = off, nonzero = on checkbutton: onvalue = on, everything else = off
One of the goals of tkwidgets is to have the Tk widgets represented in Pd as directly as possible. Then the Tk docs apply, for example. And it will hopefully be easier to manage more complicated configurations if there isn't a layer of abstraction between Tk and Pd.
If you are interested in working on tkwidgets, that would be great! I think the easiest place to start would be to make a 'label' object based on the Tk label widget.
.hc
From: Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-dev List pd-dev@iem.at Sent: Wednesday, August 17, 2011 7:24 PM Subject: Re: tkwidgets
On Aug 17, 2011, at 6:23 PM, Jonathan Wilkes wrote:
How does your private git branch differ from what's currently in svn?
I pushed my git to github, my latest work is in the 'newentry' branch. I basically focused on the [entry] widget to see if I could get it going with this new approach.
https://github.com/pd-projects/tkwidgets
One thing I'd like to point out is that your tkwidgets suffer from the same problem tot/widget did -- by handling all the widget state in tcl you make it impossible to use your objects inside a subpatch/ abstraction that doesn't have a visible canvas (because the widget no longer exists). I was considering create a "master" widget as a child of the main window and sync it to the widget drawn on the canvas, but that seems like a lot of trouble. Is there some other workaround?
That is true, but tkwidgets are all about using Tk widgets in Pd as easily as possible. If the Tk widget is not drawn to the screen, then the Tk widget is not involved. What is the problem in particular? You want to change its state while its not visible? I think the idea there is to have the state stored in the standard struct as a dump from the Tk widget. So when its not visible, store the state-changes, when it becomes visible, dump the state to the Tk widget.
Another thing: to get "Pd-style" interaction, bind $canvas <<EditMode>> to a proc that sets -state to disabled for all tkwidgets in that $canvas when editmode == 1. That way you don't end up triggering the widget when you want to edit it.
Yeah, tkwidgets was mostly written about the same time as I starting the pd-gui-rewrite. As I rewrote a lot of pd-gui, I realized I should wait on tkwidgets since I could fix a lot of things in pd-gui first. The <<EditMode>> message is one example. tkwdigets is not complete yet, so this is not fully in there. I think the [entry] in github does this kind of stuff.
.hc
Hans-Christoph Steiner hans@at.or.at To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-dev List pd-dev@iem.at Sent: Wednesday, August 17, 2011 2:54 PM Subject: Re: tkwidgets
Hey Jonathan,
I'm cc'ing pd-dev since this is a topic that could interest others and others could contribute to. I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. The idea is to try out a new idea for how GUI objects can work. Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui <--> pd communications, and making it easier to write GUI objects. Its not trivial to do, but should be doable.
.hc
On Aug 17, 2011, at 12:26 PM, Jonathan Wilkes wrote:
Never mind, I see it now inside canvas_vis... too bad canvas' "window" subcommand doesn't have something like pack's "-in" option...
But I guess I could make a toplevel checkbutton widget and just manually clone it.
-Jonathan
From: Jonathan Wilkes jancsika@yahoo.com To: Hans- Christoph Steiner hans@at.or.at Sent: Wednesday, August 17, 2011 3:14 AM Subject: tkwidgets
Hi Hans, Do I have it right that your tkwidgets get destroyed when the containing patch is vis'd 0? If so, any hints on how this happens?
Specifically, I'm playing around with [checkbutton], and even if I comment out everything in eraseme and checkbutton_free, and every single "destroy" subcommand, I still get a tcl error when sending a bang or float to a [checkbutton] that's in a subpatch with no window mapped:
(Tcl) INVALID COMMAND NAME: invalid command name ".x252a690.c.widget25272b0" while executing ".x252a690.c.widget25272b0 cget -onvalue" ("uplevel" body line 2) invoked from within "uplevel #0 $cmd_from_pd"
Man has survived hitherto because he was too ignorant to know how to realize his wishes. Now that he can realize them, he must either change them, or perish. -William Carlos Williams
"We have nothing to fear from love and commitment." - New York Senator Diane Savino, trying to convince the NY Senate to pass a gay marriage bill
----------------------------------------------------------------------------
As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously. - Benjamin Franklin
On 08/17/2011 08:54 PM, Hans-Christoph Steiner wrote:
I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. The idea is to try out a new idea for how GUI objects can work. Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui <--> pd communications, and making it easier to write GUI objects. Its not trivial to do, but should be doable.
hiho
sorry for bumping in but what about giving up tcl-tk and go on with something more "modern" (Ã la Qt), with a decent OO interface ?
I might miss the obvious as I'm new here but what about rewriting pd GUI in Qt ? wouldn't it make more sense than spending time hacking on and on tcl-tk code ?
my 0.001$ _y
The pd/pd-gui divide is a little misleading-- there are lots of places in the c code where there are sys_gui and sys_vgui calls with tcl in them, plus c code that probably assumes tcl is being used on the gui side. You'll either need to write a wrapper for those calls, or modify a lot of c code and basically make a fork (iemguis, canvas stuff, etc.)
But even if you write a wrapper, there are still issues that will need to be dealt with on the c side to minimize the number of messages passing back and forth between pd and gui. For example, there is one call per xlet to the gui when an object gets instantiated/vis'd, plus drawing the border and text, rather than one call per object (and letting the gui deal with where to draw xlets, box width, font, etc.).
-Jonathan
From: yvan volochine yvan.pd@gmail.com To: Hans-Christoph Steiner hans@at.or.at Cc: Jonathan Wilkes jancsika@yahoo.com; pd-dev List pd-dev@iem.at Sent: Thursday, August 25, 2011 6:18 PM Subject: Re: [PD-dev] tkwidgets
On 08/17/2011 08:54 PM, Hans-Christoph Steiner wrote:
I've started a private git branch of tkwidgets that I intent to push once I get somewhere with it. The idea is to try out a new idea for how GUI objects can work. Basically, I think I can make it so that Tcl handles more of the interaction with the user, minimizing on pd-gui <--> pd communications, and making it easier to write GUI objects. Its not trivial to do, but should be doable.
hiho
sorry for bumping in but what about giving up tcl-tk and go on with something more "modern" (à la Qt), with a decent OO interface ?
I might miss the obvious as I'm new here but what about rewriting pd GUI in Qt ? wouldn't it make more sense than spending time hacking on and on tcl-tk code ?
my 0.001$ _y