Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

tkinter from inside PSSE

I am trying to develop a script which would run from within PSSE (ie, launched as an automation script via Ctrl+Shift+A) which displays a GUI using tkinter. The UI in general displays, but I've noticed odd quirks like clicking on a menu item in PSSE usually takes two or three clicks (kind of like the program is being unresponsive). Also sometimes fields in PSSE will not populate while the script is running. For example (in PSSE v30):

  1. Open the attached demo script using Ctrl+Shift+A. Keep the script running.
  2. Use GOUT to generate a diagram of any bus in your system.
  3. Double click on that bus, which will bring up the Network data bus viewer. The table in the viewer will not populate with data.
  4. Close the GOUT window and return to the network data viewer. (Still unpopulated)
  5. Now close the script. All of a sudden the data will populate.

It looks to me like tkinter is not giving full focus back to PSSE. Anyone know what to do to get this to work.

Sample Code:

# UI Example for psspy.org    
from Tkinter import *

class appForm( Frame ):    
    def __init__( self, master=None ):            
        """Create the GUI"""
        Frame.__init__( self, master )
        self.pack()

        self.btnTest = Button(self, text="Button")
        self.btnTest.pack()

if __name__ == "__main__":
    # Set up TK
    root = Tk()

    # Run the program
    app = appForm(master=root)
    app.mainloop()

Thanks!