A while ago, I reported a bug introduced in the
transition wxPython 2.4 --> 2.5 using vertical sliders with ticks and labels. This bug had apparently been fixed at some point in the
2.5 series from what I remember was reported on this list.
I just upgraded to wxPython 2.6.0.0 (unicode) on Windows XP
and found that the bug I reported is unfortunately still there.
The program below illustrates the problem.
The first slider created should have its origin at
(40, 70); instead, it appears at (0, 0).
If I set the height to the default value (-1),
then it gets positioned properly; however, it is
then too short for my needs.
André
···
=============================================
import wx
app = wx.PySimpleApp()
class myframe(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Icon Frame",
size=(300, 300), pos=(-1, -1))
class TestPopup(wx.PopupWindow):
"""Adds a bit of text and mouse movement to the wx.PopupWindow"""
def __init__(self, parent, style):
wx.PopupWindow.__init__(self, parent, style)
self.slider_v = wx.Slider(
# id, value, min, max, (x, y), (length, height)
self, -1, 10, 0, 40, (40, 70), (-1, 320),
wx.SL_VERTICAL | wx.SL_AUTOTICKS | wx.SL_LABELS
)
self.slider_h = wx.Slider(
# id, value, min, max, (x, y), (length, height)
self, -1, 10, 0, 40, (60, 50), (300, -1),
wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS
)
self.SetSize( (360, 340) )
wx.CallAfter(self.Refresh)
class TestPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
b = wx.Button(self, -1, "Show sliders", (25, 50))
wx.EVT_BUTTON( self, -1, self.OnShowPopup)
def OnShowPopup(self, evt):
win = TestPopup(self, wx.SIMPLE_BORDER)
# Show the popup right below or above the button
# depending on available screen space...
btn = evt.GetEventObject()
pos = btn.ClientToScreen( (0,0) )
sz = btn.GetSize()
win.Position(pos, (0, sz[1]))
win.Show(True)
#----------------------------------------------------------------------
def runTest(frame):
win = TestPanel(frame)
return win
frame = myframe()
runTest(frame)
frame.Show()
app.MainLoop()