wx/wxPython: How to add a slider to a grid cell?
I need to show a slider in one column of a grid. I was able to create a custom CellEditor which displays the slider when I double click into a cell of the appropriate column so it enters the edit mode. But I don't know how to create a custom CellRenderer that displays the slide开发者_如何学Pythonr in all cell that are not in edit mode. Unfortunately the wx.RendererNative does not offer such a method like DrawSlider() :-(
I appreciate any suggestion.
Below you can see an example of what is working so far. You can see the one cell with the sl
Maybe you could use the editor to set the numeric value of the cell, then on the renderer draw a vertical bar by dividing the value by the maximum possible value and multiplying it by the width of the cell (in px, to get the proportion of the cell that the slider needs to appear at) and drawing a narrow vertical rectangle at this point that would act as the indicator, something like:
+---------------+ | |-| | +---------------+
Note that this is untested, but I plan to do something similar on my current project. Just out of curiosity, how did you get the slider to appear in the editor?
精彩评论