Tina,

        You don't want to create a new thread -- Tcl/tk can only support
a single thread.  Instead, you either need to wholly replace the
external GUI with your GUI, or you simply need to make your gui work
with the standard external GUI.  The latter is generally done by adding
your own menu, which then creates it's own window in response to user
requests.

Cheers,
Warren


--
mailto:war...@delanoscientific.com
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154 
Fax   (650)-593-4020

> -----Original Message-----
> From: pymol-users-ad...@lists.sourceforge.net [mailto:pymol-users-
> ad...@lists.sourceforge.net] On Behalf Of Tina Li
> Sent: Friday, September 05, 2003 11:49 AM
> To: pymol-users@lists.sourceforge.net
> Subject: [PyMOL] adding a new external GUI
> 
> Hello,
> 
> I'm trying to add another external GUI to be positioned at the bottom
of
> the
> structure window for displaying sequence alignments, with not much
luck.
> Here
> is what I want and what I've done:
> 
> Goal: when opening a sequence alignment file in the existing GUI,
launch a
> new
> GUI at the bottom displaying the alignments. So:
> 
> - in \modules\pmg_tk, add a new class alignApp that inherits from
> AbstractApp
> (very similar to PMGApp for the exsting GUI), which adds widgets to
the
> new
> GUI and will parse files, etc..
> 
> - in \modules\pmg_tk\startup, add startNewGUI.py, whose __init__()
adds an
> additional file open option (all files in this directory are
__init__'d
> upon
> startup of the existing GUI) to the existing GUI's File menu:
> 
> -------------------------------
> from pmg_tk.alignApp import *
> 
> def run_alignApp():
>     if not hasattr(sys,"argv"):
>       sys.argv=["pymol"]
>     alignApp(balloon_state='both').run()
> 
> def alignment_open(self):
>   ofile = askopenfilename(initialdir = self.initialdir,
>                           filetypes=[("XML File","*.xml"),
>                                      ("All Files","*.*"),
>                                      ("All Files","*"),])
>   if len(ofile):
>      self.initialdir = re.sub(r"[^\/\\]*$","",ofile)
>      t_alignApp = threading.Thread(target=run_alignApp,args=())
>      t_alignApp.setDaemon(1)
>      t_alignApp.start()
> 
> def __init__(self):
>       self.menuBar.addmenuitem('File', 'command', 'Open alignment
file.',
>                         label=self.pad+'Open alignments',
>                         command=lambda s=self:alignment_open(s))
> -------------------------------
> 
> The result: the new GUI appears as a "one-piece" small square frame
(1/6
> the
> width of the existing). No menu, output area or other widgets is
shown.
> After
> clicking in either GUI, the cursor turns busy, and both GUIs turn
> non-responding.
> 
> I'm not sure if it's a Python thread problem on my part. Has anyone
done
> something similar before? Let me know if it's more appropriate to ask
in a
> Python newsgroup.
> 
> Thanks much!
> 
> Tina
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> PyMOL-users mailing list
> PyMOL-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pymol-users



Reply via email to