mirror of https://github.com/chriskiehl/Gooey.git
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
47 lines
869 B
'''
|
|
Util for supporting WxPython 3 & 4
|
|
'''
|
|
|
|
import wx
|
|
try:
|
|
import wx.adv
|
|
except ImportError:
|
|
pass
|
|
|
|
isLatestVersion = wx.version().startswith('4')
|
|
|
|
|
|
class Constants:
|
|
if isLatestVersion:
|
|
WX_FONTSTYLE_NORMAL = wx.FONTSTYLE_NORMAL
|
|
WX_DP_DROPDOWN = wx.adv.DP_DROPDOWN
|
|
else:
|
|
WX_FONTSTYLE_NORMAL = wx.FONTWEIGHT_NORMAL
|
|
WX_DP_DROPDOWN = wx.DP_DROPDOWN
|
|
|
|
|
|
class Classes:
|
|
if isLatestVersion:
|
|
DatePickerCtrl = wx.adv.DatePickerCtrl
|
|
else:
|
|
DatePickerCtrl = wx.DatePickerCtrl
|
|
|
|
|
|
|
|
|
|
def imageFromBitmap(bitmap):
|
|
if isLatestVersion:
|
|
return bitmap.ConvertToImage()
|
|
else:
|
|
return wx.ImageFromBitmap(bitmap)
|
|
|
|
|
|
def bitmapFromImage(image):
|
|
if isLatestVersion:
|
|
return wx.Bitmap(image)
|
|
else:
|
|
return wx.BitmapFromImage(image)
|
|
|
|
|
|
|
|
|