Skip to content

Window icon and title are not set properly #268

Open
@broughtong

Description

@broughtong

What doesn't work?

Changing a window icon using sdl2.SDL_SetWindowIcon doesn't work on Ubuntu 20.04.

Creating a window in the C++ SDL has no logo set by default (in pysdl2 it has a python logo by default).

Changing it with SDL_SetWindowIcon in C++ correctly sets it, but same code in python does nothing, the logo remains the Python logo. I've tried hiding the window to start with, setting the logo, and then showing it but same issue. Likewise the title showing in the taskbar is always "Python (v3.8)" regardless of what sdl2.SDL_SetWindowTitle is set to.

How To Reproduce
Any code that reproduces the bug, e.g.:

import time
import ctypes
import sdl2
import sdl2.ext
import sdl2.sdlimage

def main():
    sdl2.SDL_Init(sdl2.SDL_INIT_EVERYTHING)

    window = sdl2.SDL_CreateWindow(b"Test Window", sdl2.SDL_WINDOWPOS_UNDEFINED, sdl2.SDL_WINDOWPOS_UNDEFINED, 400, 400, 0) #sdl2.SDL_WINDOW_HIDDEN)

    icon = sdl2.sdlimage.IMG_Load(b"icon.png")
    sdl2.SDL_SetWindowIcon(window, icon)
    print(sdl2.SDL_GetError())

    sdl2.SDL_ShowWindow(window)

    sdl2.SDL_SetWindowTitle(window, b"New title")

    time.sleep(5)

    sdl2.SDL_DestroyWindow(window)
    sdl2.SDL_Quit()

if __name__ == "__main__":
    main()

Platform (if relevant):

  • OS: Ubuntu 20.04
  • Python Version: 3.8.10
  • PySDL2 version: 0.9.16
  • SDL2 Version: 2.0.10
  • Using pysdl2-dll: no

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions