How to make Renderer only occupy half of the window?

11 views
Skip to first unread message

Eric Zhang

unread,
Mar 26, 2018, 11:23:36 PM3/26/18
to Kivy users support
Hi Kivy gurus,

I'm making an app that shows a 2D image on the left pane of my window and a 3D rendering on the right pane.

I started by modifying https://kivy.org/docs/examples/gen__3Drendering__main__py.html so that the Renderer only occupy the right half of the window. 

To this end, I created a box layout, which occupies only the right half pane, to hold this Renderer in the hope that it would "contain" my Renderer. However, the Renderer still draws on the entire window, as shown in the attached screenshot.

Why can't the box layout constrain the Renderer's canvas? How can I achieve my goal?

Thanks so much in advance for your help!
Eric
My_and_3Drendering_and_CD.png

Roger Johnson

unread,
Mar 26, 2018, 11:52:21 PM3/26/18
to kivy-...@googlegroups.com
I use pos_hint on all my stuff but you have to use it all the way down from what I understand.  Showing at least your BoxLayout declaration code would be helpful. 

I created a box layout

If you used kv then I probably can't help but if you used python then the

pos_hint={"center":1,"right":1}}


might help.  Also boxlayout is my favorite since it seems to adhere to the lowest level of a widget.  For only half the pane horizontal you will also need

size_hint=(0.5,1)


Eric Zhang

unread,
Mar 27, 2018, 8:54:31 AM3/27/18
to Kivy users support
Thanks! I already had size_hint, and also tried pos_hint as you suggested, but unfortunately the problem persists.

I did arrangement, sizing, etc. in kv. Here's the relevant part of my kv code.

BoxLayout:
    orientation: 'vertical'
    spacing: 10
    # Viewer
    BoxLayout:
        orientation: 'horizontal'
        Picture:
            id: viewer_2d
            size_hint: 0.5, 1
        Interactive:
            id: viewer_3d
            size_hint: 0.5, 1
    # Menu
    GridLayout:
        id: menu
        rows: 1
        spacing: 4, 4
        size_hint_y: None
        height: 60

`Interactive`, derived from `BoxLayout`, holds my `Renderer`.

Thanks so much!
Reply all
Reply to author
Forward
0 new messages