Skip to content

pygame._sdl2.Renderer is broken on my system. #2190

@yolowex

Description

@yolowex

Environment:

  • Operating system:
  • OS: Kali GNU/Linux Rolling x86_64
  • Kernel: 6.1.0-kali7-amd64
  • Python version 3.11.2
  • SDL version 2.26.4
  • PyGame version 2.2.1
  • Relevant hardware
  • CPU: 11th Gen Intel i7-11700 (16) @ 4.800GHz
  • GPU: Intel RocketLake-S GT1 [UHD Graphics 750]

Current behavior:
_sdl2.renderer is broken on my system.
it says that Renderer is already associated with window

Expected behavior:
I want to render things using _sdl2

Steps to reproduce:

I just copied the code that @Starbuck5 made in discord _sdl2 channel, and pasted it into my problem, running it.

Test code

import pygame
from pygame._sdl2 import Renderer, Texture, Window
import os
here = os.path.abspath(".")+"/"
pygame.init()

screen = pygame.display.set_mode((0,0), flags=pygame.FULLSCREEN)
window = Window.from_display_module()
renderer = Renderer(window)

texture = Texture.from_surface(renderer, pygame.image.load(here+"Capture.PNG"))

print(list(pygame._sdl2.get_drivers()))

clock = pygame.time.Clock()

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

        if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
            running = False

    renderer.draw_color = (255, 255, 255, 255)
    renderer.clear()

    texture.draw(None, None)

    renderer.present()

    clock.tick()
    print(clock.get_fps(), end="\r")

pygame.quit()
  • Traceback, Stacktrace, error log ( or whatever it's called )
Traceback (most recent call last):
  File "/home/yolo/Workstation/Python/pygame/android-unit-test/main.py", line 10, in <module>
    import sdl2_test
  File "/home/yolo/Workstation/Python/pygame/android-unit-test/sdl2_test.py", line 9, in <module>
    renderer = Renderer(window)
               ^^^^^^^^^^^^^^^^
  File "src_c\cython\pygame\_sdl2\video.pyx", line 1107, in pygame._sdl2.video.Renderer.__init__
pygame._sdl2.sdl2.error: Renderer already associated with window

Metadata

Metadata

Assignees

No one assigned

    Labels

    _sdl2pygame._sdl2bugNot working as intendeddisplaypygame.displaywindowpygame.Window

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions