On Oct 30, 2009, at 10:24 PM, Ivica Ico Bukvic wrote:
Hey Ivica,
Just make it a global, that's the easiest. Or use namespaces and namespace variables.
.hc
I am not all that good with tk. Only learned what I had to to hack together better version of pd.tk. Any examples would be most appreciated. How do namespaces work?
Also, after opening tons of windows that generate global variables, doesn't this effectively produce a minor but nonetheless present memory leak as the global variables will be hard to trace when deallocating those windows (see my other email re: improvements)?
Ico
Look at the new pd-gui-rewrite branch, it uses namespaces a fair amount. They are a bit overcomplicated in Tcl, but you don't have to use the complicated parts.
.hc
----------------------------------------------------------------------------
kill your television
On Sat, Oct 31, 2009 at 7:00 PM, Hans-Christoph Steiner hans@at.or.atwrote:
On Oct 30, 2009, at 10:24 PM, Ivica Ico Bukvic wrote:
Hey Ivica,
Just make it a global, that's the easiest. Or use namespaces and namespace variables.
.hc
I am not all that good with tk. Only learned what I had to to hack together better version of pd.tk. Any examples would be most appreciated. How do namespaces work?
Also, after opening tons of windows that generate global variables, doesn't this effectively produce a minor but nonetheless present memory leak as the global variables will be hard to trace when deallocating those windows (see my other email re: improvements)?
Ico
Look at the new pd-gui-rewrite branch, it uses namespaces a fair amount. They are a bit overcomplicated in Tcl, but you don't have to use the complicated parts.
.hc
Hans, when you have a few minutes can you just sum up quickly how does it go with namespaces? I've familiarized easy with everything else in the sources, but i couldn't get namespaces do anything (thus my tabbed-console plugin doesn't see the popupmode setting).
Btw, i would be happy to clean up pdtk_post as suggested by the comments, but i have questions: - "this should be switchable between Pd window and stderr": how do you imagine this; a command line switch or from preferences...? - you mentioned you would shift popupmode to a plugin, is it ok if i give it a shot?
Andras
On Oct 31, 2009, at 3:12 PM, András Murányi wrote:
On Sat, Oct 31, 2009 at 7:00 PM, Hans-Christoph Steiner hans@at.or.at wrote:
On Oct 30, 2009, at 10:24 PM, Ivica Ico Bukvic wrote:
Hey Ivica,
Just make it a global, that's the easiest. Or use namespaces and namespace variables.
.hc
I am not all that good with tk. Only learned what I had to to hack together better version of pd.tk. Any examples would be most appreciated. How do namespaces work?
Also, after opening tons of windows that generate global variables, doesn't this effectively produce a minor but nonetheless present memory leak as the global variables will be hard to trace when deallocating those windows (see my other email re: improvements)?
Ico
Look at the new pd-gui-rewrite branch, it uses namespaces a fair amount. They are a bit overcomplicated in Tcl, but you don't have to use the complicated parts.
.hc
Hans, when you have a few minutes can you just sum up quickly how does it go with namespaces? I've familiarized easy with everything else in the sources, but i couldn't get namespaces do anything (thus my tabbed-console plugin doesn't see the popupmode setting).
Here are the basics:
Create a namespace 'pdwindow' with the variable 'printout_buffer' in it: namespace eval pdwindow { variable printout_buffer ... }
use the 'printout_buffer' variable anywhere with the namespace prefix: puts $::pdwindow::printout_buffer
Create a proc in the 'pdwindow' namespace and use 'printout_buffer' without the prefix: proc ::pdwindow::pdtk_post {message} { variable printout_buffer puts $printout_buffer ... }
Call the pdtk_post proc from anywhere:
::pdwindow::pdtk_post "blah blah"
All the pdtk_post proc to be used outside of the 'pdwindow' namespace: namespace eval pdwindow { ... namespace export pdtk_post ... }
Use the 'pdtk_post' proc from the pdwindow namespace globally without the prefix namespace import ::pdwindow::pdtk_post pdtk_post "blah blah"
Btw, i would be happy to clean up pdtk_post as suggested by the comments, but i have questions:
- "this should be switchable between Pd window and stderr": how do
you imagine this; a command line switch or from preferences...?
- you mentioned you would shift popupmode to a plugin, is it ok if i
give it a shot?
Sure, but I recently fixed those two, thanks to mescalinum's opt_parser code. :) I suppose I should remove the TODO...
.hc
----------------------------------------------------------------------------
kill your television