def _GetDialogTemplate(self, dlgClassName):
style = win32con.WS_THICKFRAME | win32con.WS_POPUP | win32con.WS_VISIBLE | win32con.WS_CAPTION | win32con.WS_SYSMENU | win32con.DS_SETFONT | win32con.WS_MINIMIZEBOX
cs = win32con.WS_CHILD | win32con.WS_VISIBLE
title = "Dynamic Dialog Demo"
# Window frame and title
dlg = [ [title, (0, 0, 210, 250), style, None, (8, "MS Sans Serif"), None, dlgClassName], ]
# ID label and text box
dlg.append([130, "Enter something", -1, (5, 5, 200, 9), cs | win32con.SS_LEFT])
s = cs | win32con.WS_TABSTOP | win32con.WS_BORDER
dlg.append(['EDIT', None, IDC_SEARCHTEXT, (5, 15, 200, 12), s])
# Search/Display Buttons
# (x positions don't matter here)
s = cs | win32con.WS_TABSTOP
dlg.append([128, "Fill List", IDC_BUTTON_SEARCH, (5, 35, 50, 14), s | win32con.BS_DEFPUSHBUTTON])
s = win32con.BS_PUSHBUTTON | s
dlg.append([128, "Display", IDC_BUTTON_DISPLAY, (100, 35, 50, 14), s])
# List control.
# Can't make this work :(
## s = cs | win32con.WS_TABSTOP
## dlg.append(['SysListView32', "Title", IDC_LISTBOX, (5, 505, 200, 200), s])
return dlg
python类WS_POPUP的实例源码
def hide_extra_ui(self, hwnd=None, remove=True):
"""
:param hwnd: Hwnd to remove all styling from. If not supplied, then the default hwnd is used
:param remove: If true: Removes all styling. If false: Adds back the removed styles
:return: NoneType
"""
logging.debug('Trying to manipulate UI')
if hwnd is None:
hwnd = self.get_hwnd()
style = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
if remove:
logging.debug('Removing UI')
style = style | win32con.WS_POPUP
style = style & ~win32con.WS_OVERLAPPEDWINDOW
else:
logging.debug('Adding UI')
style = style & ~win32con.WS_POPUP
style = style | win32con.WS_OVERLAPPEDWINDOW
win32gui.ShowWindow(hwnd, win32con.SW_HIDE)
win32gui.SetWindowLong(hwnd, win32con.GWL_STYLE, style)
win32gui.ShowWindow(hwnd, win32con.SW_SHOW)