canvas.before and canvas.after in python code

631 views
Skip to first unread message

Niko Skrypnik

unread,
Jun 11, 2013, 9:10:40 AM6/11/13
to kivy-...@googlegroups.com
Hi guys! I think many of you know what is the canvas.before and canvas.after in kv code. But I'm curious - how to define it in python code, e.g. I want to subclass Label and add some instructions before and after widget canvas. How can I do it in Python code, not in kv code.

Thank you in advance.

J.H

unread,
Jun 11, 2013, 9:14:18 AM6/11/13
to kivy-...@googlegroups.com
Hi,

class MyWidget(Widget):
    def __init__(self, **kwargs):
        super(MyWidget, self).__init__(**kwargs)
        with self.canvas:
            # add your instruction for main canvas here

        with self.canvas.before:
            # you can use this to add instructions rendered before

        with self.canvas.after:
            # you can use this to add instructions rendered after

http://kivy.org/docs/guide2/graphics.html

J.H

Niko Skrypnik

unread,
Jun 11, 2013, 9:55:42 AM6/11/13
to kivy-...@googlegroups.com
Oh, cool! Thanks a lot!


--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/DIdVMnDCzrc/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Best regards. Niko Skrypnik.
Reply all
Reply to author
Forward
0 new messages