Here are a few ideas --- just some suggestions.
Do you have the latest graphics drivers for your machine?
If you can try your app on a different platform to rule out driver
issues.
If you believe this is happening during touch events, you could
log all the touch events, it may give you an indication of what is
causing the problem.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/8752c0bb-31a8-4cb3-be87-a1c5ae8b6327%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/c5364b2b-8ff2-4119-ac68-76d3d86f5858%40googlegroups.com.
class LineWidget(GUIWidget):
"""A line widget. A simple sequence of points"""
def __init__(self, points, width, **kwargs):
GUIWidget.__init__(self, **kwargs)
self.points = points
with self.canvas:
self.line_color = theme.system.line.Color()
self.line = Line(width=width)
self.bind(size=self.update_rect, pos=self.update_rect)
def update_rect(self, instance, value):
"""Update the point positions."""
self.pos = instance.pos
if self.points:
self.line.points = self.get_points(self.points)
def set_color(self, color):
"""Change the color"""
self.line_color.rgb = color
Here is a suggestion:
Change ‘with self.canvas:’ to ‘with self.canvas.after:’
Just a guess on my part, perhaps something is changing the rendering order, and ‘your’ canvas is ending up below another layer.
Hi,
and when it goes wrong it changes to:
All the items rendered with the kivy.graphics objects have gone!
This is using 1.9.1-1build3 (in Ubuntu) and 1.9.1-dev (from kivypie on an RPi)
Does anyone have a clue as to what might be causing this or how to track it down? It seems to happen on touch events, but it is so rare it's been impossible so far to find any commonality and there is no error report output to stdout/stderr or the .kivy/log/
Thank you
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/8752c0bb-31a8-4cb3-be87-a1c5ae8b6327%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/c5364b2b-8ff2-4119-ac68-76d3d86f5858%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/0a0b28ee-38f0-4139-b29e-f7d83d06d9e5%40googlegroups.com.
although I didn't think it was possible to change the order after widgets had be add()'d
I’m not a Kivy developer – just a user. This is how I understand things. Adding a widget adds the widget to the widget tree data structure. The canvas is simply a set of drawing instructions. There is a property to draw in 3 layers, canvas.before, canvas, and canvas.after.
I’ve done limited work with the canvas using it to create custom widgets. I had to use these layering functions to have the custom widget render correctly. I put the background image on canvas.before, and the dynamic elements on canvas.after.
It could be there is a race condition drawing the kivy native widgets on the canvas and your drawing, resulting in at some odd interval you lose, and end up below what is drawn.
Give it a try and let me know if it works out.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/75909c00-e43e-449f-8eed-767b90123af9%40googlegroups.com.
with self.canvas.before:
if background_color is None:
background_color = theme.primary.black
self._background_color = Color(*background_color)
self._background_rectangle = Rectangle(size=self.size, pos=self.pos)
Here is an idea to help with the debug.
Use the callback statement to print (or log) when the drawing is happening.
https://kivy.org/doc/stable/api-kivy.graphics.instructions.html?highlight=canvas%20callback
I’d suggest printing the time and the enough description to know what is being printed. This could show if the layers were being printed in the wrong order.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/b60676ca-4aa6-449a-a87e-317adbae4df2%40googlegroups.com.
with self.canvas:
self.body_color = theme.system.amplifier_body.Color()
self.body = Triangle()
self.line_color = theme.system.amplifier_border.Color()
self.line = Line(width=border_line_width, close=True)
if self.app.debug_info:
Callback(self._debug_info)
Fascinating. Can you share the output you are collecting from the callback?
Have you used canvas.after?
What did you mean by: ‘it's definitely on add_widget()'d once.’ ?
My mental model:
on calling add_widget(), the canvas code would be executed (scheduled to be executed).
from the app.run() loop, the canvas code would be executed if there was an event that could change the screen.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/8b79cc19-3f47-48c3-b524-7b9d11e67f66%40googlegroups.com.
Fascinating. Can you share the output you are collecting from the callback?
Have you used canvas.after?
What did you mean by: ‘it's definitely on add_widget()'d once.’ ?
My mental model:
on calling add_widget(), the canvas code would be executed (scheduled to be executed).
from the app.run() loop, the canvas code would be executed if there was an event that could change the screen.