当前位置: 首页>>代码示例>>Python>>正文


Python win32gui.CreateWindow方法代码示例

本文整理汇总了Python中win32gui.CreateWindow方法的典型用法代码示例。如果您正苦于以下问题:Python win32gui.CreateWindow方法的具体用法?Python win32gui.CreateWindow怎么用?Python win32gui.CreateWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32gui的用法示例。


在下文中一共展示了win32gui.CreateWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestSetWorldTransform

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def TestSetWorldTransform():
    wc = win32gui.WNDCLASS()
    wc.lpszClassName = 'test_win32gui_1'
    wc.style =  win32con.CS_GLOBALCLASS|win32con.CS_VREDRAW | win32con.CS_HREDRAW
    wc.hbrBackground = win32con.COLOR_WINDOW+1
    wc.lpfnWndProc=wndproc_1
    class_atom=win32gui.RegisterClass(wc)       
    hwnd = win32gui.CreateWindow(wc.lpszClassName,
        'Spin the Lobster!',
        win32con.WS_CAPTION|win32con.WS_VISIBLE,
        100,100,900,900, 0, 0, 0, None)
    for x in xrange(500):
        win32gui.InvalidateRect(hwnd,None,True)
        win32gui.PumpWaitingMessages()
        time.sleep(0.01)
    win32gui.DestroyWindow(hwnd)
    win32gui.UnregisterClass(wc.lpszClassName, None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:win32gui_demo.py

示例2: __init__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def __init__(self,hwndparent):
        styles = win32con.WS_CHILD \
                | win32con.WS_VISIBLE \
                | win32con.WS_CLIPSIBLINGS \
                | win32con.WS_CLIPCHILDREN \
                | commctrl.TBSTYLE_LIST \
                | commctrl.TBSTYLE_FLAT \
                | commctrl.TBSTYLE_TRANSPARENT \
                | commctrl.CCS_TOP \
                | commctrl.CCS_NODIVIDER \
                | commctrl.CCS_NORESIZE \
                | commctrl.CCS_NOPARENTALIGN
        self.hwnd = win32gui.CreateWindow('ToolbarWindow32', None, styles,
                                          0, 0, 100, 100,
                                          hwndparent, 0, win32gui.dllhandle,
                                          None)
        win32gui.SendMessage(self.hwnd, commctrl.TB_BUTTONSTRUCTSIZE, 20, 0) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:ietoolbar.py

示例3: __init__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def __init__(self):
        message_map = {
            win32con.WM_DEVICECHANGE: self.onDeviceChange
        }

        wc = win32gui.WNDCLASS()
        hinst = wc.hInstance = win32api.GetModuleHandle(None)
        wc.lpszClassName = "DeviceChangeDemo"
        wc.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW
        wc.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)
        wc.hbrBackground = win32con.COLOR_WINDOW
        wc.lpfnWndProc = message_map
        classAtom = win32gui.RegisterClass(wc)
        style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
        self.hwnd = win32gui.CreateWindow(
            classAtom,
            "Device Change Demo",
            style,
            0, 0,
            win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT,
            0, 0,
            hinst, None
        ) 
开发者ID:FabioBaroni,项目名称:WAS,代码行数:25,代码来源:was.py

示例4: _create_window

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def _create_window(self,
                       style=win32con.WS_OVERLAPPED | win32con.WS_SYSMENU):
        # Create the Window.
        hwnd = win32gui.CreateWindow(self.class_atom,
                                     self.window_class_name,
                                     style,
                                     0,
                                     0,
                                     310,
                                     250,
                                     0,
                                     0,
                                     self.hinst,
                                     None)
        win32gui.UpdateWindow(hwnd)
        return hwnd 
开发者ID:eavatar,项目名称:eavatar-me,代码行数:18,代码来源:window.py

示例5: create_window

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def create_window(self):
        # Create the Window.
        style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
        hwnd = win32gui.CreateWindow(self.class_atom,
                                     self.window_class_name,
                                     style,
                                     0,
                                     0,
                                     310,
                                     250,
                                     0,
                                     0,
                                     self.hinst,
                                     None)
        win32gui.UpdateWindow(hwnd)
        return hwnd 
开发者ID:eavatar,项目名称:eavatar-me,代码行数:18,代码来源:shell.py

示例6: __init__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def __init__(self):
    message_map = {
      win32con.WM_DEVICECHANGE : self.onDeviceChange
    }
    
    wc = win32gui.WNDCLASS ()
    hinst = wc.hInstance = win32api.GetModuleHandle (None)
    wc.lpszClassName = "DeviceChangeDemo"
    wc.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
    wc.hCursor = win32gui.LoadCursor (0, win32con.IDC_ARROW)
    wc.hbrBackground = win32con.COLOR_WINDOW
    wc.lpfnWndProc = message_map
    classAtom = win32gui.RegisterClass (wc)
    style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
    self.hwnd = win32gui.CreateWindow (
      classAtom,
      "Device Change Demo",
      style,
      0, 0,
      win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT,
      0, 0,
      hinst, None
    ) 
开发者ID:mehulj94,项目名称:BrainDamage,代码行数:25,代码来源:check_external_drive.py

示例7: __init__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def __init__(self, name):
        self.logger = logging.getLogger(name)
        self.hwnd = win32gui.CreateWindow(
            self.CLASS_ATOM, name,
            (win32con.WS_OVERLAPPED | win32con.WS_SYSMENU),
            0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, 0, 0,
            self.WNDCLASS.hInstance, None)
        self._create(self.hwnd, self)
        self.logger.info('create: name=%r' % name)
        return 
开发者ID:euske,项目名称:pyrexecd,代码行数:12,代码来源:__init__.py

示例8: CreateViewWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def CreateViewWindow(self, prev, settings, browser, rect):
        print "ScintillaShellView.CreateViewWindow", prev, settings, browser, rect
        # Make sure scintilla.dll is loaded.  If not, find it on sys.path
        # (which it generally is for Pythonwin)
        try:
            win32api.GetModuleHandle("Scintilla.dll")
        except win32api.error:
            for p in sys.path:
                fname = os.path.join(p, "Scintilla.dll")
                if not os.path.isfile(fname):
                    fname = os.path.join(p, "Build", "Scintilla.dll")
                if os.path.isfile(fname):
                    win32api.LoadLibrary(fname)
                    break
            else:
                raise RuntimeError("Can't find scintilla!")

        style = win32con.WS_CHILD | win32con.WS_VSCROLL | \
                win32con.WS_HSCROLL | win32con.WS_CLIPCHILDREN | \
                win32con.WS_VISIBLE
        self.hwnd = win32gui.CreateWindow("Scintilla", "Scintilla", style,
                              rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1], 
                              self.hwnd_parent, 1000, 0, None)

        message_map = {
                win32con.WM_SIZE: self.OnSize,
        }
#        win32gui.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, message_map)

        file_data = file(self.filename, "U").read()

        self._SetupLexer()
        self._SendSci(scintillacon.SCI_ADDTEXT, len(file_data), file_data)
        if self.lineno != None:
            self._SendSci(scintillacon.SCI_GOTOLINE, self.lineno)
        print "Scintilla's hwnd is", self.hwnd 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:38,代码来源:shell_view.py

示例9: _SetupList

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def _SetupList(self):
        child_style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_BORDER | win32con.WS_HSCROLL | win32con.WS_VSCROLL
        child_style |= commctrl.LVS_SINGLESEL | commctrl.LVS_SHOWSELALWAYS | commctrl.LVS_REPORT
        self.hwndList = win32gui.CreateWindow("SysListView32", None, child_style, 0, 0, 100, 100, self.hwnd, IDC_LISTBOX, self.hinst, None)

        child_ex_style = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
        child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
        win32gui.SendMessage(self.hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)

        # Add an image list - use the builtin shell folder icon - this
        # demonstrates the problem with alpha-blending of icons on XP if
        # winxpgui is not used in place of win32gui.
        il = win32gui.ImageList_Create(
                    win32api.GetSystemMetrics(win32con.SM_CXSMICON),
                    win32api.GetSystemMetrics(win32con.SM_CYSMICON),
                    commctrl.ILC_COLOR32 | commctrl.ILC_MASK,
                    1, # initial size
                    0) # cGrow

        shell_dll = os.path.join(win32api.GetSystemDirectory(), "shell32.dll")
        large, small = win32gui.ExtractIconEx(shell_dll, 4, 1)
        win32gui.ImageList_ReplaceIcon(il, -1, small[0])
        win32gui.DestroyIcon(small[0])
        win32gui.DestroyIcon(large[0])
        win32gui.SendMessage(self.hwndList, commctrl.LVM_SETIMAGELIST,
                             commctrl.LVSIL_SMALL, il)

        # Setup the list control columns.
        lvc = LVCOLUMN(mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM)
        lvc.fmt = commctrl.LVCFMT_LEFT
        lvc.iSubItem = 1
        lvc.text = "Title"
        lvc.cx = 200
        win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
        lvc.iSubItem = 0
        lvc.text = "Order"
        lvc.cx = 50
        win32gui.SendMessage(self.hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())

        win32gui.UpdateWindow(self.hwnd) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:42,代码来源:win32gui_dialog.py

示例10: CreateWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def CreateWindow(self):
        # Create the window via CreateDialogBoxIndirect - it can then
        # work as a "normal" window, once a message loop is established.
        self._DoCreate(win32gui.CreateDialogIndirect) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:win32gui_dialog.py

示例11: DemoCreateWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def DemoCreateWindow():
    w=DemoWindow()
    w.CreateWindow()
    # PumpMessages runs until PostQuitMessage() is called by someone.
    win32gui.PumpMessages() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:win32gui_dialog.py

示例12: new_icon

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def new_icon(hdesk,desktop_name):
    """ Runs as a thread on each desktop to create a new tray icon and handle its messages """ 
    global id
    id=id+1
    hdesk.SetThreadDesktop()
    ## apparently the threads can't use same hinst, so each needs its own window class
    windowclassname='PythonDesktopManager'+desktop_name
    wc = win32gui.WNDCLASS()
    wc.hInstance = win32api.GetModuleHandle(None)
    wc.lpszClassName = windowclassname
    wc.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW | win32con.CS_GLOBALCLASS
    wc.hCursor = win32gui.LoadCursor( 0, win32con.IDC_ARROW )
    wc.hbrBackground = win32con.COLOR_WINDOW
    wc.lpfnWndProc = icon_wndproc
    windowclass = win32gui.RegisterClass(wc)
    style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
    hwnd = win32gui.CreateWindow(windowclass, 'dm_'+desktop_name, win32con.WS_SYSMENU,
                    0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT,
                    0, 0, wc.hInstance, None)
    win32gui.UpdateWindow(hwnd)
    flags = win32gui.NIF_ICON | win32gui.NIF_MESSAGE | win32gui.NIF_TIP
    notify_info = (hwnd, id, flags, win32con.WM_USER+20, hicon, 'Desktop Manager (%s)' %desktop_name)
    window_info[hwnd]=notify_info
    ## wait for explorer to initialize system tray for new desktop
    tray_found=0
    while not tray_found:
        try:
            tray_found=win32gui.FindWindow("Shell_TrayWnd",None)
        except win32gui.error:
            traceback.print_exc
            time.sleep(.5)
    win32gui.Shell_NotifyIcon(win32gui.NIM_ADD, notify_info)
    win32gui.PumpMessages() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:35,代码来源:desktopmanager.py

示例13: _show_console

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def _show_console(self):
        if self.destroyed:
            return

        if self.console is None:
            self.console = Console(self)
            self.console.CreateWindow()
            _logger.debug("Console created.")

        _logger.debug("Show console")
        self.console.show()
        self.console.bring_to_top() 
开发者ID:eavatar,项目名称:eavatar-me,代码行数:14,代码来源:shell.py

示例14: balloon_tip

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def balloon_tip(self, title, msg):
        style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
        hwnd = CreateWindow(self.classAtom, "Taskbar", style, 0, 0,
                            win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT,
                            0, 0, self.hinst, None)
        UpdateWindow(hwnd)

        hicon = LoadIcon(0, win32con.IDI_APPLICATION)

        nid = (hwnd, 0, NIF_ICON | NIF_MESSAGE | NIF_TIP, win32con.WM_USER + 20, hicon, 'Tooltip')
        Shell_NotifyIcon(NIM_ADD, nid)
        nid = (hwnd, 0, NIF_INFO, win32con.WM_USER + 20, hicon, 'Balloon Tooltip', msg, 200, title, NIIF_INFO)
        Shell_NotifyIcon(NIM_MODIFY, nid)

        DestroyWindow(hwnd) 
开发者ID:paulrouget,项目名称:servoshell,代码行数:17,代码来源:win32_toast.py

示例15: __init__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import CreateWindow [as 别名]
def __init__(self):
        message_map = {
                win32con.WM_DESTROY: self.OnDestroy,
                win32con.WM_COMMAND: self.OnCommand,
                win32con.WM_SIZE: self.OnSize,
        }
        # Register the Window class.
        wc = win32gui.WNDCLASS()
        hinst = wc.hInstance = win32api.GetModuleHandle(None)
        wc.lpszClassName = "test_explorer_browser"
        wc.lpfnWndProc = message_map # could also specify a wndproc.
        classAtom = win32gui.RegisterClass(wc)
        # Create the Window.
        style = win32con.WS_OVERLAPPEDWINDOW | win32con.WS_VISIBLE
        self.hwnd = win32gui.CreateWindow( classAtom, "Python IExplorerBrowser demo", style, \
                0, 0, win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, \
                0, 0, hinst, None)
        eb = pythoncom.CoCreateInstance(shellcon.CLSID_ExplorerBrowser, None, pythoncom.CLSCTX_ALL, shell.IID_IExplorerBrowser)
        # as per MSDN docs, hook up events early
        self.event_cookie = eb.Advise(wrap(EventHandler()))

        eb.SetOptions(shellcon.EBO_SHOWFRAMES)
        rect = win32gui.GetClientRect(self.hwnd)
        # Set the flags such that the folders autoarrange and non web view is presented
        flags = (shellcon.FVM_LIST, shellcon.FWF_AUTOARRANGE | shellcon.FWF_NOWEBVIEW)
        eb.Initialize(self.hwnd, rect, (0, shellcon.FVM_DETAILS))
        if len(sys.argv)==2:
            # If an arg was specified, ask the desktop parse it.
            # You can pass anything explorer accepts as its '/e' argument -
            # eg, "::{guid}\::{guid}" etc.
            # "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" is "My Computer"
            pidl = shell.SHGetDesktopFolder().ParseDisplayName(0, None, sys.argv[1])[1]
        else:
            # And start browsing at the root of the namespace.
            pidl = []
        eb.BrowseToIDList(pidl, shellcon.SBSP_ABSOLUTE)
        # and for some reason the "Folder" view in the navigator pane doesn't
        # magically synchronize itself - so let's do that ourself.
        # Get the tree control.
        sp = eb.QueryInterface(pythoncom.IID_IServiceProvider)
        try:
            tree = sp.QueryService(shell.IID_INameSpaceTreeControl,
                                   shell.IID_INameSpaceTreeControl)
        except pythoncom.com_error, exc:
            # this should really only fail if no "nav" frame exists...
            print "Strange - failed to get the tree control even though " \
                  "we asked for a EBO_SHOWFRAMES"
            print exc 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:50,代码来源:explorer_browser.py


注:本文中的win32gui.CreateWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。