File: tkwindow.py

package info (click to toggle)
pymol 1.8.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,248 kB
  • ctags: 24,095
  • sloc: cpp: 474,635; python: 75,034; ansic: 22,888; sh: 236; makefile: 78; csh: 21
file content (29 lines) | stat: -rw-r--r-- 696 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# demonstration plugin which opens up a window on startup
#
# you must copy this file into modules/pmg_tk/startup/
#
# pymol will then run the script on startup

from Tkinter import *
from tkFileDialog import *
from pymol import cmd

class myTkWindow:

    def __init__(self,app):
        self.root = Tk()
        self.app = app
        self.root.geometry(newGeometry="+900+50")
        Button(self.root,
               text="Open File",
               command=lambda s=self:s.open()).pack()

    def open(self):
        file_list = askopenfilename(multiple=1)
        for file in file_list:
            self.app.pymol.cmd.load(file)
        
def __init__(app):
    myTkWindow(app)