def CreateWindow(title, className, width, height, xpos=None, ypos=None, icon=None, windowProc=None):

    """
    for key in g_windows:
        if g_windows[key] == className:
            raise Exception("There was already created a window with that className: %s."
                "Each created window must have an unique className." % className)
    """

    if not windowProc:
        windowProc = {win32con.WM_CLOSE: WM_CLOSE}

    bigIcon = ""
    smallIcon = ""

    if icon:
        icon = GetRealPath(icon)

        # Load small and big icon.
        # WNDCLASSEX (along with hIconSm) is not supported by pywin32,
        # we need to use WM_SETICON message after window creation.

        # http://stackoverflow.com/questions/2234988/how-to-set-hicon-on-a-window-ico-with-multiple-sizes
        # http://blog.barthe.ph/2009/07/17/wmseticon/

        bigX = win32api.GetSystemMetrics(win32con.SM_CXICON)
        bigY = win32api.GetSystemMetrics(win32con.SM_CYICON)
        bigIcon = win32gui.LoadImage(0, icon, win32con.IMAGE_ICON, bigX, bigY, win32con.LR_LOADFROMFILE)
        smallX = win32api.GetSystemMetrics(win32con.SM_CXSMICON)
        smallY = win32api.GetSystemMetrics(win32con.SM_CYSMICON)
        smallIcon = win32gui.LoadImage(0, icon, win32con.IMAGE_ICON, smallX, smallY, win32con.LR_LOADFROMFILE)

    wndclass = win32gui.WNDCLASS()
    wndclass.hInstance = win32api.GetModuleHandle(None)
    wndclass.lpszClassName = className
    wndclass.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW
    # win32con.CS_GLOBALCLASS
    wndclass.hbrBackground = win32con.COLOR_WINDOW
    wndclass.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)
    wndclass.lpfnWndProc = windowProc

    #noinspection PyUnusedLocal
    global g_registeredClasses
    if not className in g_registeredClasses:
        g_registeredClasses[className] = True
        atomclass = win32gui.RegisterClass(wndclass)
        Debug(className % "win32gui.RegisterClass(%s)")

    if xpos is None or ypos is None:
        # Center window on the screen.
        Debug("Centering window on the screen.")
        screenx = win32api.GetSystemMetrics(win32con.SM_CXSCREEN)
        screeny = win32api.GetSystemMetrics(win32con.SM_CYSCREEN)
        xpos = int(math.floor((screenx - width) / 2))
        ypos = int(math.floor((screeny - height) / 2))
        if xpos < 0: xpos = 0
        if ypos < 0: ypos = 0

    windowID = win32gui.CreateWindow(className, title,
            win32con.WS_OVERLAPPEDWINDOW | win32con.WS_CLIPCHILDREN | win32con.WS_VISIBLE,
            xpos, ypos, width, height, # xpos, ypos, width, height
            0, 0, wndclass.hInstance, None)
    g_windows[windowID] = className

    if icon:
        if bigIcon:
            win32api.SendMessage(windowID, win32con.WM_SETICON, win32con.ICON_BIG, bigIcon)
        if smallIcon:
            win32api.SendMessage(windowID, win32con.WM_SETICON, win32con.ICON_SMALL, smallIcon)

    Debug("windowID = %s" % windowID)
    return windowID


# Memory error when calling win32gui.DestroyWindow()
# after we called cefpython.CloseBrowser()
dataset/ETHPy150Open cztomczak/cefpython/cefpython/cef3/windows/binaries_32bit/cefwindow.py/CreateWindow/swapped operands of `%`