Taking the same concept a little further, you can use the grid tools to calculate the data in the cells
Here is a Surface Speed to RPM calculator
Changing either of the two input values and then by clicking on any other cell, outputs the results.
Quick, Dirty and Functional
Note: The csv file has to be accessible, as it is reading from that file on load.
Update: Formatting and highlighting cells is shown in the added image.
Here's a snippet that formats the code (in two separate functions)
But it shows how to get cell data, compute it, set the new values and then create the alignment, colors, and font sizing
SS_g_SurfaceSpeedsGrid:SetCellAlignment(0,2,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(1,2,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(0,0,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(1,0,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(3,0,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(4,0,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(6,0,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(6,1,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
for i = 7, 17 do --Loop through the last 10 rows column 0
SS_g_SurfaceSpeedsGrid:SetCellAlignment(i,0,wx.wxALIGN_RIGHT,wx.wxALIGN_RIGHT)
i=i+1
end
SS_g_SurfaceSpeedsGrid:SetCellBackgroundColour(0, 2, wx.wxColour(wx.wxGREEN))--This code changes the new cell to green
SS_g_SurfaceSpeedsGrid:SetCellBackgroundColour(6, 0, wx.wxColour(wx.wxGREEN))--This code changes the new cell to green
SS_g_SurfaceSpeedsGrid:SetCellBackgroundColour(6, 1, wx.wxColour(wx.wxGREEN))--This code changes the new cell to green
local SFM=SS_g_SurfaceSpeedsGrid:GetCellValue(0, 2)
local DIA=SS_g_SurfaceSpeedsGrid:GetCellValue(1, 2)
local PI=3.141592654
RPM = (SFM * 12)/(DIA * PI)
SFM = (DIA * PI * RPM)/12
RPM = string.format("%0.0f",tostring(RPM))
SS_g_SurfaceSpeedsGrid:SetCellAlignment(3,3,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellAlignment(4,3,wx.wxALIGN_CENTER, wx.wxALIGN_CENTER)
SS_g_SurfaceSpeedsGrid:SetCellValue(3, 3, tostring(RPM))
SS_g_SurfaceSpeedsGrid:SetCellValue(4, 3, tostring(SFM))
SS_g_SurfaceSpeedsGrid:SetCellBackgroundColour(3, 3, wx.wxColour(230,230,230))--This code changes the new cell to gray
SS_g_SurfaceSpeedsGrid:SetCellTextColour(3, 3, wx.wxColour(wx.wxRED))--This code changes the new cell to Red
SS_g_SurfaceSpeedsGrid:SetCellFont(3, 3, wx.wxFont(14,0,0,0))--This code changes the font size
SS_g_SurfaceSpeedsGrid:SetCellBackgroundColour(4, 3, wx.wxColour(wx.wxGREEN))--This code changes the new cell to green