def __init__(self): window.Wnd.__init__(self, win32ui.CreateWnd()) self._obj_.CreateWindowEx(WS_EX_CLIENTEDGE, \ win32ui.RegisterWndClass(0, 0, COLOR_WINDOW + 1), \ 'Lipanfeng', WS_OVERLAPPEDWINDOW, \ (10, 10, 800, 500), None, 0, None) self.HookMessage(self.OnRClick, WM_RBUTTONDOWN)
def __init__(self): window.Wnd.__init__(self, win32ui.CreateWnd()) self._obj_.CreateWindowEx(WS_EX_CLIENTEDGE, \ win32ui.RegisterWndClass(0, 0, COLOR_WINDOW + 1), \ 'MFC GUI', WS_OVERLAPPEDWINDOW, \ (10, 10, 800, 500), None, 0, None) # 捕获右键单击消息 submenu = win32ui.CreatePopupMenu() menu = win32ui.CreateMenu() submenu.AppendMenu(MF_STRING, 1051, '&Open') submenu.AppendMenu(MF_STRING, 1052, '&Close') submenu.AppendMenu(MF_STRING, 1053, '&Save') menu.AppendMenu(MF_STRING | MF_POPUP, submenu.GetHandle(), '&File') submenu = win32ui.CreateMenu() submenu.AppendMenu(MF_STRING, 1054, '&Copy') submenu.AppendMenu(MF_STRING, 1055, '&Paste') submenu.AppendMenu(MF_SEPARATOR, 1056, None) submenu.AppendMenu(MF_STRING, 1057, '&Cut') menu.AppendMenu(MF_STRING | MF_POPUP, submenu.GetHandle(), '&Edit') submenu = win32ui.CreateMenu() submenu.AppendMenu(MF_STRING, 1058, 'Tools') submenu.AppendMenu(MF_STRING | MF_GRAYED, 1059, 'Setting') m = win32ui.CreateMenu() m.AppendMenu(MF_STRING | MF_POPUP | MF_CHECKED, submenu.GetHandle(), 'Option') menu.AppendMenu(MF_STRING | MF_POPUP, m.GetHandle(), '&Other') self._obj_.SetMenu(menu)
def tm_info(self): win = ui.CreateWnd() dc = win.GetDC() dc.SelectObject(self._win_font) tm = dc.GetTextMetrics() win.ReleaseDC(dc) return tm
def __init__ (self): window.Wnd.__init__(self,win32ui.CreateWnd()) self._clstyle=0 self._style=0 self._exstyle=0 self._icon=0 self._cursor=0 self._brush=0
def __init__(self, config=None, share_group=None, **kwds): config = GLConfig._from_args(config, kwds) win = ui.CreateWnd() win.CreateWindow(None, None, win_style, win_default_rect, win_none, 0) dc = win.GetDC() hdc = dc.GetSafeHdc() GLContext.__init__(self, share_group, config, hdc, 'screen') GGLView.__init__(self, _win=win, **kwds) self._with_context(hdc, self._init_context) win.ReleaseDC(dc)
def Create(self, title, style, rect, parent): classStyle = win32con.CS_HREDRAW | win32con.CS_VREDRAW className = win32ui.RegisterWndClass(classStyle, 0, win32con.COLOR_WINDOW+1, 0) self._obj_ = win32ui.CreateWnd() self._obj_.AttachObject(self) self._obj_.CreateWindow(className, title, style, rect, parent, win32ui.AFX_IDW_PANE_FIRST) self.HookMessage (self.OnSize, win32con.WM_SIZE) self.HookMessage (self.OnPrepareToClose, WM_USER_PREPARE_TO_CLOSE) self.HookMessage (self.OnDestroy, win32con.WM_DESTROY) self.timerid = timer.set_timer (100, self.OnTimer) self.InvalidateRect()
def __init__(self, **kwds): kwds.setdefault('border', True) kwds.setdefault('extent', default_extent) kwds.setdefault('scrolling', default_scrolling) win = ui.CreateWnd() win.CreateWindowEx(win_ex_style, win_plain_class, None, win_style, win_default_rect, win_none, 0) win.HookMessage(self._win_wm_hscroll, wc.WM_HSCROLL) win.HookMessage(self._win_wm_vscroll, wc.WM_VSCROLL) GScrollableView.__init__(self, _win=win) self.set(**kwds)
def __init__(self, parent): window.Wnd.__init__(self, win32ui.CreateWnd()) self._parent = parent self._text = None self._bgcolor = 0xFF, 0xFF, 0xE0 # LightYellow self._rect = 20, 20, 112, 38 self._margins = 2, 0, 2, 0 self._dxoffset = 16 self._blackbrush = Sdk.CreateBrush(win32con.BS_SOLID, 0, 0) fd = {'name': 'Arial', 'height': 10, 'weight': 500} self._hsmallfont = Sdk.CreateFontIndirect(fd)
def __init__(self): # The window.Wnd ctor creates a Window object, and places it in # self._obj_. Note the window object exists, but the window itself # does not! window.Wnd.__init__(self, win32ui.CreateWnd()) # Now we ask the window object to create the window itself. self._obj_.CreateWindowEx(win32con.WS_EX_CLIENTEDGE, \ win32ui.RegisterWndClass(0, 0, win32con.COLOR_WINDOW + 1), \ 'Hello World!', win32con.WS_OVERLAPPEDWINDOW, \ (100, 100, 400, 300), None, 0, None)
def __init__(self, text = "New Label", **kwds): self._set_lines(text) lines = self._lines font = self._win_predict_font(kwds) w = 0 for line in lines: w = max(w, font.width(line)) w = int(ceil(w)) h = self._calc_height(font, len(lines)) win = ui.CreateWnd() win.CreateWindow(None, None, win_style, (0, 0, w, h), win_none, 0) #win.ModifyStyleEx(0, wc.WS_EX_TRANSPARENT, 0) GLabel.__init__(self, _win = win, **kwds)
def __init__(self): window.Wnd.__init__(self, win32ui.CreateWnd()) self._obj_.CreateWindowEx(WS_EX_CLIENTEDGE,\ win32ui.RegisterWndClass(0, 0, COLOR_WINDOW+1),\ 'MFC GUI', WS_OVERLAPPEDWINDOW,\ (10, 10, 800, 500), None, 0, None) # create menu object submenu = win32ui.CreatePopupMenu() menu = win32ui.CreateMenu() # add sth into menu submenu.AppendMenu(MF_STRING, 1051, '&Open') submenu.AppendMenu(MF_STRING, 1052, '&Close') submenu.AppendMenu(MF_STRING, 1053, '&Save') menu.AppendMenu(MF_STRING | MF_POPUP, submenu.GetHandle(), '&File') # add menu into window self._obj_.SetMenu(menu) # set menu process message self.HookCommand(self.MenuClick, 1051) self.HookCommand(self.MenuClick, 1052) self.HookCommand(self.MenuClick, 1053)
def __init__(self): window.Wnd.__init__(self, win32ui.CreateWnd()) self._obj_.CreateWindowEx( WS_EX_CLIENTEDGE, win32ui.RegisterWndClass(0, 0, COLOR_WINDOW + 1), 'MFC GUI', WS_OVERLAPPEDWINDOW, (10, 10, 800, 500), None, 0, None) self.HookMessage(self.OnRClick, WM_RBUTTONDOWN) submenu = win32ui.CreateMenu() menu = win32ui.CreateMenu() submenu.AppendMenu(MF_STRING, 1051, '&Open') submenu.AppendMenu(MF_STRING, 1052, '&Close') submenu.AppendMenu(MF_STRING, 1053, '&Save') menu.AppendMenu(MF_STRING | MF_POPUP, submenu.GetHandle(), '&File') submenu = win32ui.CreateMenu() submenu.AppendMenu(MF_STRING, 1054, '&Copy') submenu.AppendMenu(MF_STRING, 1055, '&Paste') submenu.AppendMenu(MF_SEPARATOR, 1056, None) submenu.AppendMenu(MF_STRING, 1057, 'C&ut') menu.AppendMenu(MF_STRING | MF_POPUP, submenu.GetHandle(), '&Edit') submenu = win32ui.CreateMenu() submenu.AppendMenu(MF_STRING, 1058, 'Tools') submenu.AppendMenu(MF_STRING | MF_GRAYED, 1059, 'Settings') m = win32ui.CreateMenu() m.AppendMenu(MF_STRING | MF_POPUP | MF_CHECKED, submenu.GetHandle(), 'Option') menu.AppendMenu(MF_STRING | MF_POPUP, m.GetHandle(), '&Other') self._obj_.SetMenu(menu) self.HookCommand(self.MenuClick, 1051) self.HookCommand(self.MenuClick, 1052) self.HookCommand(self.MenuClick, 1053) self.HookCommand(self.MenuClick, 1054) self.HookCommand(self.MenuClick, 1060)
def __init__(self, **kwds): win = ui.CreateWnd() win.CreateWindow(None, None, win_style, win_default_rect, win_none, 0) GView.__init__(self, _win=win) self.set(**kwds)
def __init__(self): window.Wnd.__init__(self, win32ui.CreateWnd()) self._obj_.CreateWindowEx( WS_EX_CLIENTEDGE, win32ui.RegisterWndClass(0, 0, COLOR_WINDOW + 1), 'MFC GUI', WS_OVERLAPPEDWINDOW, (100, 100, 400, 300), None, 0, None)
wc.WM_MBUTTONDOWN, wc.WM_MBUTTONDBLCLK, wc.WM_MBUTTONUP, wc.WM_RBUTTONDOWN, wc.WM_RBUTTONDBLCLK, wc.WM_RBUTTONUP, #wc.WM_MOUSELEAVE, ) # Dummy CWnd for use as parent of containerless components. # Also used as the main frame of the CWinApp. win_none = ui.CreateFrame() win_none.CreateWindow(None, "", 0, (0, 0, 10, 10)) win_plain = ui.CreateWnd() win_plain.CreateWindow(None, None, 0, (0, 0, 10, 10), win_none, 0) win_plain_class = gui.GetClassName(win_plain.GetSafeHwnd()) #-------------------------------------------------------------------- win_command_map = { 0: '_win_bn_clicked', # BN_CLICKED wc.CBN_SELCHANGE: '_cbn_sel_change', wc.EN_CHANGE: '_en_change', } class WinMessageReflector(object): def _win_install_event_hooks(self, win): win.HookMessage(self._win_wm_scroll, wc.WM_HSCROLL)
def __init__(self, wnd=None): if wnd is None: wnd = win32ui.CreateWnd() window.Wnd.__init__(self, wnd)
def __init__(self, **kwds): w, h = self._default_size win = ui.CreateWnd() win.CreateWindow(None, None, win_flags, (0, 0, w, h), win_none, 0) GFrame.__init__(self, _win = win, **kwds)
def __init__(self): window.Wnd.__init__(self, win32ui.CreateWnd())
def __init__(self, drawContext): window.Wnd.__init__(self, win32ui.CreateWnd()) LayoutWnd.__init__(self, drawContext)