I am trying to create a GUI app that lets me plot any variable against any other variable. This is my first GUI app, so perhaps I'm biting more than I can chew. The values of these variables are in arrays, which I have grouped into collections -- that is , I use collections.nametuple to group the raw values, the calculated magnitude and phase, the peak index, and a normalized values (please forgive me if I'm not using the correct terminology), for example.
What I would like to do is to have all these variables (or elements of the various collections(?) as choices in two ComboBoxes, xdata and ydata, so that I can plot any variable against any other variable. Is this even possible to do? This is the MainWindow of the app I'm trying to create:
I have the selection of the file, and the parsing of the data working, and for example, say I created these two collections from the data in the file:
type_aData = collections.namedtuple('type_aData',
'A_RX '
'A_RXlogmag '
'A_RXmag'
'A_RXph'
'A_pkMagInd'
'A_RXlogmag_N'
'A_RXmag_N'
'A_RX_N'
'A_RXph_N')
type_distance = collections.namedtuple('type_distance',
'A'
'B')
each A_x is an array, and so are distanceA and distanceB. I'd like to do something like:
self.xdata.addItem(type_distance)
self.ydata.addItem(type_adata)
so that the all the distance variables and aData variables are exposed in the x and y data ComboBoxes, but it complains that the arguments cannot be of type 'type'. If I instead use 'type_distance', for example, in quotes, then all I get is the text in the ComboBox and not the actual variables (never mind that I still don't know how to grab the value selected from the ComboBox to do something with it --that's the next hurdle!).
In short, what I'd like to ultimately be able to do is select the variables I want to plot from the x and y data ComboBoxes so that I can use them in a function that would do something like:
self.data_line=self.graphWidget.plot(self.distance.A, self.aData.A_RX)
or
self.data_line=self.graphWidget.plot(self.distance.A, self.aData.A_RXph),
for example.
If anyone can point me to examples of simple GUI apps that do something similar to what I'm trying to do here , that would be great. I"m not married to doing it this way ---I just don't know any better. I get the feeling I'm complicating this way more than it needs to be.