<enable switch> <A Big Label Here>
<some fancy widget fills the rest of the space>
class UIApp(App): def build(self): root = Widget(size_hint=(1, 1))
tl = AnchorLayout(size_hint=(1, 1), anchor_y='top', anchor_x='left') tr = AnchorLayout(size_hint=(1, 1), anchor_y='top', anchor_x='right') bl = AnchorLayout(size_hint=(1, 1), anchor_y='bottom', anchor_x='left')
tl.add_widget(Label(text='one')) tr.add_widget(Label(text='two')) bl.add_widget(Label(text='three'))
root.add_widget(tl) root.add_widget(tr) root.add_widget(bl) return root
UIApp().run()
--
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/09581f5a-03bf-4d7e-8aa0-c22d5487a23e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To use the AnchorLayout (or any layout) Make the root a Layout, not a widget.
I also recommend using KV Lang. It is much more productive that just coding it all directly.
There is a great example in the example folder, called the Kivy Catalog that has examples of all of the layouts, and the KV code used in the example. You can edit the KV code and see the results in the app interactively.
In order to create the look I believe you are going for I would
not choose to use an AnchorLayout . I would use a set of nested
BoxLayouts. I have also attached the code.
from kivy.app import App from kivy.lang import Builder kv_test = ''' BoxLayout: orientation: 'vertical' BoxLayout: size_hint_y: .1 Switch: Label: text: 'Your Big Label' Label: text: 'Make this blank' # replace this with text:'' this is a placeholder for the layout to center your Label Button: text: 'The rest goes here' ''' class TestLayoutApp(App): def build(self): return Builder.load_string(kv_test) TestLayoutApp().run()
and the output looks like:
--
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/dc6bdce9-b418-4857-9e83-1f8620f41dc1%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/af17a2e8-f572-c723-e433-c5a5f065c48a%40cox.net.
For more options, visit https://groups.google.com/d/optout.
some_fancy
text: 'some_fancy'
--
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/e74b6edd-b708-4238-bc1e-f1065ddfae05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.