You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
869 B

  1. '''
  2. Util for supporting WxPython 3 & 4
  3. '''
  4. import wx
  5. try:
  6. import wx.adv
  7. except ImportError:
  8. pass
  9. isLatestVersion = wx.version().startswith('4')
  10. class Constants:
  11. if isLatestVersion:
  12. WX_FONTSTYLE_NORMAL = wx.FONTSTYLE_NORMAL
  13. WX_DP_DROPDOWN = wx.adv.DP_DROPDOWN
  14. else:
  15. WX_FONTSTYLE_NORMAL = wx.FONTWEIGHT_NORMAL
  16. WX_DP_DROPDOWN = wx.DP_DROPDOWN
  17. class Classes:
  18. if isLatestVersion:
  19. DatePickerCtrl = wx.adv.DatePickerCtrl
  20. else:
  21. DatePickerCtrl = wx.DatePickerCtrl
  22. def imageFromBitmap(bitmap):
  23. if isLatestVersion:
  24. return bitmap.ConvertToImage()
  25. else:
  26. return wx.ImageFromBitmap(bitmap)
  27. def bitmapFromImage(image):
  28. if isLatestVersion:
  29. return wx.Bitmap(image)
  30. else:
  31. return wx.BitmapFromImage(image)