Skip to content

Instantly share code, notes, and snippets.

@tmplinshi
Created September 20, 2015 13:14
Show Gist options
  • Save tmplinshi/f2dbeb9444980dfff495 to your computer and use it in GitHub Desktop.
Save tmplinshi/f2dbeb9444980dfff495 to your computer and use it in GitHub Desktop.
import ctypes
xcgui=ctypes.windll.LoadLibrary("XCGUI.dll")
#user=ctypes.windll.LoadLibrary("user32.dll")
print(xcgui)
#print(user)
#//窗口样式----------------------------
#/// @defgroup groupWindowStyle 炫彩窗口样式
#/// @ingroup macroDefine
#/// @{
XC_SY_CAPTION = 0x00000001 #///<top布局,如果指定该属性,默认为绑定标题栏元素
XC_SY_BORDER = 0x00000002 #///<边框,指定默认上下左右布局大小,如果没有指定,那么边框布局大小为0
XC_SY_CENTER = 0x00000004 #///<窗口居中
XC_SY_DRAG_BORDER = 0x00000008 #///<拖动窗口边框
XC_SY_DRAG_WINDOW = 0x00000010 #///<拖动窗口
#///窗口默认样式
XC_SY_DEFAULT = (XC_SY_CAPTION | XC_SY_BORDER | XC_SY_CENTER | XC_SY_DRAG_BORDER)
#///模态窗口
XC_SY_MODAL_WINDOW = (XC_SY_CAPTION | XC_SY_CENTER | XC_SY_BORDER)
#define SW_HIDE 0
#define SW_SHOWNORMAL 1
#define SW_NORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_MAXIMIZE 3
#define SW_SHOWNOACTIVATE 4
SW_SHOW = 5
#define SW_MINIMIZE 6
#define SW_SHOWMINNOACTIVE 7
#define SW_SHOWNA 8
#define SW_RESTORE 9
#define SW_SHOWDEFAULT 10
#define SW_FORCEMINIMIZE 11
#define SW_MAX 11
XC_LAYOUT_SIZE_Fill =1
XC_BUTTON_STYPE_CLOSE =4
xcgui.XInitXCGUI(None)
hWindow=xcgui.XWnd_Create(0,0,800,600,u"python调用炫彩界面库",None,XC_SY_DEFAULT)
xcgui.XWnd_SetLayoutSize(hWindow,1,30,1,1)
btnClose=xcgui.XBtn_Create(770,0,30,27,u'',hWindow)
xcgui.XBtn_SetStyle(btnClose,XC_BUTTON_STYPE_CLOSE)
xcgui.XBtn_SetImageLeave(btnClose,xcgui.XImage_LoadFile(u'./images/sysbtn_close_normal.png',False))
xcgui.XBtn_SetImageStay(btnClose,xcgui.XImage_LoadFile(u'./images/sysbtn_close_hover.png',False))
xcgui.XBtn_SetImageDown(btnClose,xcgui.XImage_LoadFile(u'./images/sysbtn_close_down.png',False))
xcgui.XEle_EnableBkTransparent(btnClose,True)
xcgui.XEle_EnableBorder(btnClose,False)
txtCaption=xcgui.XTextBlock_Create(0,0,600,30,u'python调用炫彩界面库',hWindow)
xcgui.XTextBlock_SetOffset(txtCaption,20,6)
xcgui.XWnd_ShowWindow (hWindow, SW_SHOW)
xcgui.XRunXCGUI(None)
xcgui.XExitXCGUI(None)
#user.MessageBoxW(None,u'我的第一个Python调用C函数例子',u'提示信息',0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment