Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception ignored in: 'kivy.graphics.instructions.RenderContext.set_texture' #6042

Closed
GardaNegara opened this issue Nov 8, 2018 · 6 comments
Labels
Status: Has PR There's a PR available for the issue

Comments

@GardaNegara
Copy link

GardaNegara commented Nov 8, 2018

Versions

  • Python: 3.6.7
  • OS: Debian Testing
  • Kivy: 1.10.1
  • Kivy installation method: pip in a virtualenv per the official installation instructions. I've made sure I have the correct version of Cython (0.25.2).

Description

I've successfully run the Pong tutorial without hiccups. However, the following Hello World code taken from the book Kivy: Interactive Applications in Python - Second Edition generates an exception and the buttons appear garbled/corrupted.

Code and Logs

## widgets.py
from kivy.app import App
from kivy.uix.widget import Widget

class MyWidget(Widget):
        pass

class WidgetsApp(App):
        def build(self):
                return MyWidget()

if __name__ == '__main__':
        WidgetsApp().run()

## widgets.kv
<MyWidget>:
        Button:
                text: 'Hello'
                font_size: 32
                color: .8, .9, 1
                pos: 0, 100
                size: 100, 50
        Button:
                text: 'World!'
                font_size: 32
                color: .8, .9, 1
                pos: 100, 0
                size: 100, 50

Here is the log:

[INFO   ] Logger: Record log in /home/garda/.kivy/logs/kivy_18-11-08_5.txt
[INFO   ] Kivy: v1.10.1
[INFO   ] Python: v3.6.7 (default, Oct 21 2018, 08:08:16) 
[GCC 8.2.0]
[INFO   ] Factory: 194 symbols loaded
[INFO   ] Image: Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] Window: Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] GL: Using the "OpenGL" graphics system
[INFO   ] GL: Backend used <gl>
[INFO   ] GL: OpenGL version <b'2.1 Mesa 18.1.9'>
[INFO   ] GL: OpenGL vendor <b'Intel Open Source Technology Center'>
[INFO   ] GL: OpenGL renderer <b'Mesa DRI Intel(R) 965GM '>
[INFO   ] GL: OpenGL parsed version: 2, 1
[INFO   ] GL: Shading version <b'1.20'>
[INFO   ] GL: Texture max size <8192>
[INFO   ] GL: Texture max units <16>
[INFO   ] Window: auto add sdl2 input provider
[INFO   ] Window: virtual keyboard not allowed, single mode, not docked
[INFO   ] Text: Provider: sdl2
[INFO   ] Base: Start application main loop
[INFO   ] GL: NPOT texture support is available
[WARNING] stderr: Exception ignored in: 'kivy.graphics.instructions.RenderContext.set_texture'
[WARNING] stderr: Traceback (most recent call last):
[WARNING] stderr:   File "kivy/graphics/texture.pyx", line 789, in kivy.graphics.texture.Texture.bind (/tmp/pip-install-8jmcdld_/kivy/kivy/graphics/texture.c:11612)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 662, in _texture_fill
[WARNING] stderr:     self.render(real=True)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 603, in render
[WARNING] stderr:     return self._render_real()
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 586, in _render_real
[WARNING] stderr:     self.render_lines(lines, options, self._render_text, y, size)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 564, in render_lines
[WARNING] stderr:     render_text(line, x, y)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/text_sdl2.py", line 48, in _render_text
[WARNING] stderr:     self._surface.render(self, text, x, y)
[WARNING] stderr:   File "kivy/core/text/_text_sdl2.pyx", line 127, in kivy.core.text._text_sdl2._SurfaceContainer.render (/tmp/pip-install-8jmcdld_/kivy/kivy/core/text/_text_sdl2.c:2535)
[WARNING] stderr: IndexError: list index out of range
[WARNING] stderr: Exception ignored in: 'kivy.graphics.instructions.RenderContext.set_texture'
[WARNING] stderr: Traceback (most recent call last):
[WARNING] stderr:   File "kivy/graphics/texture.pyx", line 789, in kivy.graphics.texture.Texture.bind (/tmp/pip-install-8jmcdld_/kivy/kivy/graphics/texture.c:11612)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 662, in _texture_fill
[WARNING] stderr:     self.render(real=True)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 603, in render
[WARNING] stderr:     return self._render_real()
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 586, in _render_real
[WARNING] stderr:     self.render_lines(lines, options, self._render_text, y, size)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/__init__.py", line 564, in render_lines
[WARNING] stderr:     render_text(line, x, y)
[WARNING] stderr:   File "/media/Plain/Codes/kivy/lib/python3.6/site-packages/kivy/core/text/text_sdl2.py", line 48, in _render_text
[WARNING] stderr:     self._surface.render(self, text, x, y)
[WARNING] stderr:   File "kivy/core/text/_text_sdl2.pyx", line 127, in kivy.core.text._text_sdl2._SurfaceContainer.render (/tmp/pip-install-8jmcdld_/kivy/kivy/core/text/_text_sdl2.c:2535)
[WARNING] stderr: IndexError: list index out of range
[INFO   ] Base: Leaving application in progress...
@Fak3
Copy link
Contributor

Fak3 commented Feb 21, 2019

Same error here, python 3.7.2

@Fak3
Copy link
Contributor

Fak3 commented Feb 21, 2019

Error disappears if color: is changed to have alpha value, like this: color: .8, .9, 1, 1

@Israelmath
Copy link

I had the same error and, after search a lot and almost punched my pc, I change the color and now it works well...

@pythonic64
Copy link
Contributor

Button class inherits from Label which has color property in rgba format, so you have to set color in that format to change the color of displayed text. See https://kivy.org/doc/stable/api-kivy.uix.label.html#kivy.uix.label.Label.color .
Maybe a good solution would be to replace ListProperty with ColorProperty for all color-like properties in Kivy widgets.

@pythonic64
Copy link
Contributor

Pull request #6918 replaces ListProperty with ColorProperty, so setting color in rgb format will use 1.0 as alpha value and not raise an error. Also a string in format #rrggbb or #rrggbbaa can be used to set the value for color.

@pythonic64 pythonic64 added the Status: Has PR There's a PR available for the issue label Jun 3, 2020
@pythonic64
Copy link
Contributor

Fixed in #6918.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Has PR There's a PR available for the issue
Projects
None yet
Development

No branches or pull requests

4 participants