linking GUI apps using different Toolkits...possible?

M

MooMaster

This is more of a wxPython centric question, but not seeing reference
to this on the wx group I thought I'd try here since many here also use
wxPython toolkit. I started learning GUI development with Tkinter, and
developed a few screens as part of an application I'm building with it.
I've recently been trying to learn wxPython because of it's additional
widgets (the wxTreeCtrl and Drag and Drop features in particular), and
I've developed an application where there is a splitter window with a
tree on the left side. My goal is to have a user double click on an
option and call up the appropiate display on the right side. I've
already developed the appropriate screens in Tkinter, and I'd like to
use those instead of having to re-write them in wx. I'd basically like
to pack the screen into the rightmost pane, but I have not been able to
find an effective means for doing so. What I have so far is this:
-------------------------------------------------------------------
class MyApp(wxApp):
"""driver class, creates a frame to store everything, puts 2
splitter windows inside, the first holding the tree display"""

def OnInit(self):
#create the frame
frame = MyFrame(NULL, -1, "Display")
frame.Show(true)
self.SetTopWindow(frame)

#create the splitter windows
splitter = MySplitter(frame, -1)
sty = wxBORDER_SUNKEN
self.p1 = wxWindow(splitter, style=sty)
self.p2 = wxWindow(splitter, style=sty)
self.p2.SetBackgroundColour("sky blue")
splitter.SetMinimumPaneSize(100)
splitter.SplitVertically(self.p1, self.p2, 320)

#Create the tree and add the outermost parents
self.p1.myTree = MyTreeCtrl(self.p1, -1, wxDefaultPosition,
(400,400), wxTR_HAS_BUTTONS)
self.p1.root = self.p1.myTree.AddRoot("Subsystem")
self.p1.myTree.SetPyData(self.p1.root, None)
self.p1.child1 = self.p1.myTree.AppendItem(self.p1.root, "4
Corners")
self.p1.child2 = self.p1.myTree.AppendItem(self.p1.root, "East
of River")

#Bind Drag and Drop methods to the tree to support drag and drop
self.p1.myTree.Bind(EVT_TREE_BEGIN_DRAG, self.OnBeginDrag)
self.p1.myTree.Bind(EVT_TREE_END_DRAG, self.OnEndDrag)
self.p1.myTree.Bind(EVT_LEFT_DCLICK, self.OnLeftDClick)

#Fill with children
headerLabels = ["TC43G", "Arming", "Outage", "Lines", "Graphs"]
for label in headerLabels:
grandchild = self.p1.myTree.AppendItem(self.p1.child1,
label)
self.p1.myTree.SetPyData(grandchild, None)
grandchild = self.p1.myTree.AppendItem(self.p1.child2,
label)
self.p1.myTree.SetPyData(grandchild, None)

#Expand base root to get to meat of data
self.p1.myTree.Expand(self.p1.root)
return true

#When a node is double clicked, it should display the corresponding
display on the right hand side
#currently, display pops up in separate window...
def OnLeftDClick(self, event):
pt = event.GetPosition();
item, flags = self.p1.myTree.HitTest(pt)
clicked = self.p1.myTree.GetItemText(item)
if(clicked == "Arming"):
self.p2 = ACDisplay()
elif(clicked == "Graphs"):
self.p2 = Display()
elif(clicked == "Lines"):
self.p2 = OutTable()
elif(clicked == "Outage"):
self.p2 = tablesum()
-------------------------------------------------------------------
Where ACDisplay, Display, OutTable, and tablesum are the classes I've
written already. It runs without errors, but what currently happens is
that the main window with the tree comes up, and when I double-click an
option the screen appears in a separate window. Is there a way to pack
it into the second pane (self.p2)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top