How can I embed this figure inside tabbedpanel?

27 views
Skip to first unread message

Engin Ceylan

unread,
Jul 7, 2017, 1:40:26 PM7/7/17
to Kivy users support
from kivy.uix.boxlayout import BoxLayout
from kivy.app import App

from math import cos,sin,radians as rad

class Ex14(BoxLayout):
    pass
   
class Ex14App(App):
    def build(self):
        def ellie(a,b,orig,start_ang,stop_ang,seg):
            pts=[]
            step_ang=(stop_ang-start_ang)//seg
            for ang in range(start_ang,stop_ang+step_ang,step_ang):
                pts.extend([a*cos(rad(ang))+orig[0],
                            b*sin(rad(ang))+orig[1]])
            return pts
        
        self.Head=ellie(400,300,[400,300],-45,225,6)
        self.Chin=ellie(400,300,(400,300),225,315,3)
        self.Leye=ellie(60,40,[250,450],0,360,15)
        self.Reye=ellie(60,40,(550,450),0,360,15)
        self.Mouth=ellie(160,30,[400,200],0,360,25)
        self.Nose=ellie(5,50,(400,350),0,360,25)
        print(self.Chin)
        print(len(self.Chin))
        return Ex14()

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

<Ex14>:
    canvas:
        Color:
            rgb: [.245+.05*random.random()]*3
        Rectangle:
            pos: self.pos
            size: self.size
        Color:
            rgb: 1,.1,.5
        Line:
            points: app.Head+app.Chin
            width: 3
        Color:
            rgb: 1,.5,.1
        Line:
            points: app.Leye
            width: 2
        Line:
            points: app.Reye
            width: 2
        Line:
            points: app.Mouth
            width: 2
        Line:
            points: app.Nose
            width: 2


Engin Ceylan

unread,
Jul 7, 2017, 1:42:29 PM7/7/17
to Kivy users support
My tabbed panel is:

'''
TabbedPanel
============

Test of the widget TabbedPanel.
'''

from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.lang import Builder

Builder.load_string("""

<Test>:
    size_hint: 1, 1
    pos_hint: {'center_x': .5, 'center_y': .5}
    do_default_tab: False

    TabbedPanelItem:
        text: 'first tab'
        Label:
            text: 'First tab content area'
    TabbedPanelItem:
        text: 'tab2'
        BoxLayout:
            Label:
                text: 'Second tab content area'
            Button:
                text: 'Button that does nothing'
    TabbedPanelItem:
        text: 'tab3'
        RstDocument:
            text:
                '\\n'.join(("Hello world", "-----------",
                "You are in the third tab."))

""")


class Test(TabbedPanel):
    pass


class TabbedPanelApp(App):
    def build(self):
        return Test()


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




7 Temmuz 2017 Cuma 20:40:26 UTC+3 tarihinde Engin Ceylan yazdı:

ZenCODE

unread,
Jul 7, 2017, 8:30:57 PM7/7/17
to Kivy users support
Your second post makes to mention of your <Ex14> class. So we really have no idea of the actual code you are running. Please post a complete, runnable example that we can help you with :-)

Engin Ceylan

unread,
Jul 9, 2017, 6:45:28 AM7/9/17
to Kivy users support
Runnable example is in the site. (   http://pythonmobile.blogspot.com.tr/2014/06/14-line.html    ) .  I want to embed this figure in the above-mentioned tabbedpanel.

8 Temmuz 2017 Cumartesi 03:30:57 UTC+3 tarihinde ZenCODE yazdı:

qua non

unread,
Jul 9, 2017, 11:52:02 AM7/9/17
to kivy-...@googlegroups.com
You might want to look at the examples/widgets/tabbed_panel_showcase.py

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Engin Ceylan

unread,
Jul 9, 2017, 12:39:47 PM7/9/17
to Kivy users support
Its very complex example. I just want to add a figure to the tabbedpanel. Figure is:  http://pythonmobile.blogspot.com.tr/2014/06/14-line.html .



9 Temmuz 2017 Pazar 18:52:02 UTC+3 tarihinde qua-non yazdı:
You might want to look at the examples/widgets/tabbed_panel_showcase.py
On Sun, Jul 9, 2017 at 4:15 PM, Engin Ceylan <enginc...@gmail.com> wrote:
Runnable example is in the site. (   http://pythonmobile.blogspot.com.tr/2014/06/14-line.html    ) .  I want to embed this figure in the above-mentioned tabbedpanel.

8 Temmuz 2017 Cumartesi 03:30:57 UTC+3 tarihinde ZenCODE yazdı:
Your second post makes to mention of your <Ex14> class. So we really have no idea of the actual code you are running. Please post a complete, runnable example that we can help you with :-)

--
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.

qua non

unread,
Jul 11, 2017, 10:10:17 AM7/11/17
to kivy-...@googlegroups.com
TabbedPanelItem
    Image:
        source: 'path/to/your/image.png'
TabbedPanelItem
    YourCustomWidget


Just add the child widget like in any other widget.

To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages