Small tinkering for race selection (appearance)

This commit is contained in:
HomeWorld
2011-05-16 14:46:48 +03:00
parent 2f2a81fd6c
commit 60bf53fa37
2 changed files with 16 additions and 1 deletions

View File

@@ -123,8 +123,23 @@ class RaceSelector(wx.Window):
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnBackgroundErase)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
self.Bind(wx.EVT_SIZE, self.OnSizeUpdate)
self.Layout()
def OnSizeUpdate(self,event):
rect = self.GetRect()
if self.layout == wx.HORIZONTAL:
width = 0
for bmp in self.raceBmps:
width += bmp.GetWidth() + self.buttonsPadding
posx = (rect.width - width)/2
self.buttonsBarPos = (posx,0)
self.Refresh()
event.Skip()
def OnLeftUp(self, event):
mx,my = event.GetPosition()