From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Tue Apr 12 2011 - 12:05:24 CDT

On Tue, 2011-04-12 at 19:55 +0300, Anssi Nurminen wrote:
> Thanks for the help, but it's still not getting updated.
>
> I'm thinking that the problem could be this piece of code that I have:
>
> # If already initialized, just turn on
> if { [winfo exists .myplugin] } {
> wm deiconify $w
> return
> }

hehe! yes, that block of code defeats your development efforts.

> But removing it did not help since now I get (when calling myplugin_tk):
> "window name "myplugin" already exists in parent".

you have to destroy it.
if you put:

catch {destroy $w}

before creating the new toplevel window, it will always
create a new one and it would produce an error message
and fail if there isn't a toplevel window already.

cheers,
    axel.

>
> So, how do I kill the existing old window?
>
> BR,
> Anssi Nurminen
>
>
> On 12.4.2011 19:38, Axel Kohlmeyer wrote:
> > On Tue, Apr 12, 2011 at 12:21 PM, Anssi Nurminen<anssi.nurminen_at_tut.fi> wrote:
> >> A good comparison for what I'm working on is the "Analysis/RMSD Trajectory
> >> Tool" Plugin. I'm hoping to do some calculations across trajectories and
> >> plot them possibly into a png-image file, if I cannot find a suitable
> >> heatmap-plotter.
> >>
> >> Typing "myplugin_tk" into the vmd console just opens my plugin's unupdated
> >> GUI.
> >
> > i don't know what you are doing, but i just tried it on my
> > machine and that was working fine.
> >
> > the only explanation would be that your plugin script code
> > doesn't close all open braces properly and is still "waiting"
> > for one or more closing braces.
> >
> > in any case, you don't need VMD running to debug the GUI building.
> > you can just do it with wish -f myplugin.tcl
> > and for all the VMD commands that you need to build the GUI, you
> > can just define dummy procs that provide the same format output.
> >
> > axel.
> >
> >>
> >> This is my first project with Tk/Tcl. Separating the plugin into a
> >> commandline executable version and a separate GUI might not be a bad idea.
> >> Right now I just want to get the GUI working and having a simple, fast way
> >> to get the changes updated would be desirable.
> >>
> >> BR,
> >> Anssi Nurminen
> >>
> >>
> >> On 12.4.2011 18:56, Axel Kohlmeyer wrote:
> >>>
> >>> On Tue, 2011-04-12 at 18:49 +0300, Anssi Nurminen wrote:
> >>>
> >>> anssi,
> >>>
> >>>> Just as "source", "play" has no effect; my plugin does not get updated.
> >>>> I'm installing the plugin in vmd.rc using:
> >>>> vmd_install_extension myplugin myplugin_tk "Analysis/MyPlugin"
> >>>> if that makes any difference.
> >>>>
> >>>> Is there any way to uninstall it first, before trying to re-source it?
> >>>
> >>> have you tried manually executing myplugin_tk ?
> >>>
> >>> can you please elaborate a bit on what your plugin does?
> >>>
> >>> are you writing a GUI for some existing commands in VMD,
> >>> or are you writing a new script and want to have a GUI
> >>> to go with it.
> >>>
> >>> in both cases, it is probably best to separate the GUI
> >>> part and the compute part into blocks than can be run
> >>> individually. this will not only make development easier,
> >>> but also allows people to use the text mode version
> >>> from their own scripts w/o having to go through the GUI,
> >>> which can be very desirable in case of running remotely
> >>> or when using bigdcd or something similar.
> >>>
> >>> cheers,
> >>> axel.
> >>>
> >>>
> >>>>
> >>>> BR,
> >>>> Anssi Nurminen
> >>>>
> >>>>
> >>>> On 12.4.2011 18:38, Axel Kohlmeyer wrote:
> >>>>>
> >>>>> On Tue, Apr 12, 2011 at 10:33 AM, Anssi Nurminen<anssi.nurminen_at_tut.fi>
> >>>>> wrote:
> >>>>>>
> >>>>>> John,
> >>>>>>
> >>>>>> Thanks for the quick response!
> >>>>>>
> >>>>>> I have a single .tcl file that I'm using for my plugin located in:
> >>>>>> VMD/plugins/noarch/tcl/myplugin1.0/myplugin.tcl (Windows)
> >>>>>>
> >>>>>> typing the command:
> >>>>>> "source plugins/noarch/tcl/myplugin1.0/myplugin.tcl"
> >>>>>
> >>>>> try "play plugins/noarch/tcl/myplugin1.0/myplugin.tcl"
> >>>>>
> >>>>>
> >>>>>> into the vmd console or the Tk console doesn't seem to have any
> >>>>>> effects. The
> >>>>>> command yields no output, and my plugin does not get updated. How
> >>>>>> should I
> >>>>>> use the source command?
> >>>>>
> >>>>> don't use tkconsole for that. it does a lot of tcl trickery (indeed i
> >>>>> learned a lot of
> >>>>> tcl tricks from reading its code) and has its own copy of the command
> >>>>> interpreter.
> >>>>>
> >>>>> you are better off with the regular console window.
> >>>>>
> >>>>> axel.
> >>>>>
> >>>>>
> >>>>>>
> >>>>>> BR,
> >>>>>> Anssi Nurminen
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On 12.4.2011 17:04, John Stone wrote:
> >>>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> On Tue, Apr 12, 2011 at 02:14:36PM +0300, Anssi Nurminen wrote:
> >>>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> I'm new to VMD and I'm developing a Tcl plugin. I'd have a few
> >>>>>>>> question
> >>>>>>>> about best practises.
> >>>>>>>>
> >>>>>>>> -Is there a way to vmd_uninstall_extension or to
> >>>>>>>> vmd_reload_extension?
> >>>>>>>> Currently whenever I make changes I need to restart VMD to be able to
> >>>>>>>> get my plugin reloaded (reinstalled).
> >>>>>>>
> >>>>>>> No, but you can manually "source" the newly modified script file(s)
> >>>>>>> and that will have the effect of updating the code on-the-fly.
> >>>>>>>
> >>>>>>>> -What are the VMD-community pages and how do I access them?
> >>>>>>>
> >>>>>>> They are pages maintained as a subdirectory of the VMD Public project
> >>>>>>> on BioCoRE. You can edit/create such pages, as well as various
> >>>>>>> alpha/beta versions of VMD by following the instructions here:
> >>>>>>> http://www.ks.uiuc.edu/Research/vmd/alpha/
> >>>>>>>
> >>>>>>>> -How do I turn on VMD's debugging mode? should I use it?
> >>>>>>>
> >>>>>>> If you're not working on modifying the C/C++ code, then there's
> >>>>>>> no need to run VMD within a debugger. If you're working on Tcl
> >>>>>>> scripts,
> >>>>>>> then you may find the "logfile" command useful.
> >>>>>>>
> >>>>>>>> -Other helpful tips for debugging Tcl-plugins?
> >>>>>>>
> >>>>>>> Try and test your procedures individually and be sure you've exercised
> >>>>>>> entire range of input parameters. Since Tcl is interpreted at
> >>>>>>> run-time,
> >>>>>>> it is possible to have errors in a script and not realize it until
> >>>>>>> a particular combination of parameters trigger a particular section of
> >>>>>>> code to be run that isn't usually exercised.
> >>>>>>>
> >>>>>>> Cheers,
> >>>>>>> John Stone
> >>>>>>> vmd_at_ks.uiuc.edu
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
> >
> >
> >
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.