Hi, I’ve already posted on the mail list but I guess everyone migrated here so I copy-paste my question here. Thank you.
I have a code that extracts some minimalist data using API and when double-clicking on a cell it opens a new frame with more detailed data about that row. I also select the complete row when a cell is clicked.
My problem is that when I select a row on the second frame it is also selected on the first frame. Also, when I try to select row #10, for example, on the second frame and the first frame contains less rows, the row won’t select and I receive an error message saying that the row doesn’t exist.
Is there a way to differentiate between the 2 frames? I tried renaming the second frame TestFrame1 but that doesn’t change anything.
Here is the code of the first frame, the second one is based on the same template with the only difference TestFrame1 instead of TestFrame. Thank you,
class SimpleGrid(gridlib.Grid):
def __init__(self, parent, log):
gridlib.Grid.__init__(self, parent, -1)
# test all the events
self.Bind(gridlib.EVT_GRID_SELECT_CELL, self.OnSelectCell)
def openPublishers(self, evt):
from publishers import TestFrame1
frame = TestFrame1(self, sys.stdout)
frame.Show()
#Select complete row
def OnSelectCell(self, evt):
self.log.write("OnSelectCell: (%d,%d) %s\n" %
(evt.GetRow(), evt.GetCol(), evt.GetPosition()))
self.SelectRow(evt.GetRow())
evt.Skip()
#open TestFrame1
def openPublishers(self, evt):
from publishers import TestFrame1
frame = TestFrame1(self, sys.stdout)
frame.Show()
class TestFrame(wx.Frame):
def __init__(self, parent, log):
wx.Frame.__init__(self, parent, 0, "Report", size=(1400,800))
self.grid = SimpleGrid(self, log)
if __name__ == '__main__':
import sys
from wx.lib.mixins.inspection import InspectableApp
app = InspectableApp(False)
frame = TestFrame(None, sys.stdout)
frame.Show(True)
#import wx.lib.inspection
#wx.lib.inspection.InspectionTool().Show()
app.MainLoop()
Thanks again,