mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-03-17 14:10:07 +01:00
auui_constants Easy image extraction
This commit is contained in:
@@ -2586,3 +2586,40 @@ whidbeySizeX, whidbeySizeY = 43, 30
|
||||
|
||||
SWITCHER_TEXT_MARGIN_X = 4
|
||||
SWITCHER_TEXT_MARGIN_Y = 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Easy image extraction.
|
||||
import sys
|
||||
if sys.version_info[0] == 2:
|
||||
PY2 = True
|
||||
PY3 = False
|
||||
elif sys.version_info[0] == 3:
|
||||
PY2 = False
|
||||
PY3 = True
|
||||
if PY2:
|
||||
answer = int(raw_input('Enter 1 to extract all bitmaps: '))
|
||||
elif PY3:
|
||||
answer = int(input('Enter 1 to extract all bitmaps: '))
|
||||
if answer == 1:
|
||||
app = wx.App(0)
|
||||
import os
|
||||
gAppDir = os.path.dirname(os.path.abspath(__file__))
|
||||
extractDir = gAppDir + os.sep + 'extracted_constants_bitmaps'
|
||||
if not os.path.exists(extractDir):
|
||||
# Create directory.
|
||||
os.mkdir(extractDir)
|
||||
## print(globals())
|
||||
for key, bitmap in list(globals().items()):
|
||||
## print(key, bitmap)
|
||||
try:
|
||||
bmp = bitmap.GetBitmap()
|
||||
bmp.SaveFile(extractDir + os.sep + '%s.png'%key, wx.BITMAP_TYPE_PNG)
|
||||
print('Extracting bitmap: %s.png' %(key))
|
||||
except Exception:
|
||||
pass
|
||||
app.MainLoop()
|
||||
if PY2:
|
||||
raw_input('Press Enter To Exit.')
|
||||
elif PY3:
|
||||
input('Press Enter To Exit.')
|
||||
Reference in New Issue
Block a user