-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KIVY AnchorLayout How can i put 2 children widget in 1 AnchorLayout? xd #8737
Comments
Put the two buttons in a BoxLayout, put the BoxLayout in the AnchorLayout. Ask in one of the support forums and I’ll show you an example. |
That works but still reaming some spaces in the AnchorLayout where we can not use, aren't we? |
1 similar comment
That works but still reaming some spaces in the AnchorLayout where we can not use, aren't we? |
The official support forums are: There is also a support forum on Reddit: https://www.reddit.com/r/kivy/ |
thank u , |
Both do not work for me because of internationnal problems, thanks anyway, that 2 links are awesome. |
Here is an example: from kivy.app import App
from kivy.lang import Builder
kv = """
AnchorLayout:
BoxLayout:
size_hint: None, None
size: dp(300), dp(48)
Button:
text: 'One'
Button:
text: 'Two'
"""
class TwoButtonAnchorViewApp(App):
def build(self):
return Builder.load_string(kv)
TwoButtonAnchorViewApp().run() |
thanks Example:
pls show me, bro, thanks. |
Here are 2 ways to position the widgets the way you would like. One with AnchorLayouts, the other using pos_hints in a FloatLayout. from kivy.app import App
from kivy.lang import Builder
kv = """
FloatLayout:
AnchorLayout:
anchor_x: "left"
anchor_y: "top"
Label:
id: phonetic
# font_name: "DejaVuSans.ttf"
size_hint: None, None
size: 30, 22
# color: 0, 0, 0, 1
text: 'LT'
AnchorLayout:
anchor_x: "right"
anchor_y: "bottom"
Label:
id: phonetic2
# font_name: "DejaVuSans.ttf"
size_hint: None, None
size: 30, 22
# color: 0, 0, 0, 1
text: 'BR'
# or use pos_hints in a FloatLayout or RelativeLayout
Label:
size_hint: None, None
size: 30, 22
text: 'BL'
pos_hint: {'bottom':1, 'left': 1}
Label:
size_hint: None, None
size: 30, 22
text: 'TR'
pos_hint: {'top':1, 'right': 1}
"""
class TwoButtonAnchorViewApp(App):
def build(self):
return Builder.load_string(kv)
TwoButtonAnchorViewApp().run() |
Great, thanks |
@xinzhengzhangCHN please close this issue. |
👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project. If you're having trouble installing Kivy, make sure to check out the installation docs for Windows, Linux and macOS. Let us know if this comment was made in error, and we'll be happy to reopen the issue. |
I tried times to put 2 button in 1 AnchorLayout, no a way.
Tell me a way if u find it, because i wanna it so much, i have alreadu tried more 10 times so that my deasire is so high and i want it so much.
Thanks
The text was updated successfully, but these errors were encountered: