from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem
from kivy.lang import Builder
Builder.load_string("""
<Test>:
do_default_tab: False
TabbedPanelItem:
text: 'page1'
BoxLayout:
BoxLayout:
orientation:"vertical"
Button:
text: 'dog'
Button:
text: 'cat'
BoxLayout:
orientation:"vertical"
Button:
text: 'tea'
Button:
text: 'soda'
Button:
text: 'save'
TabbedPanelItem:
text: 'page2'
BoxLayout:
TextInput:
Button:
text: 'button'
""")
class MyApp(TabbedPanel):
def build(self):
return Test()
if __name__ == '__main__':
# MyApp().run()
Choosing between dog/Cat, Tea, and Soda
Use ToggleButtons, these will ‘hold’ the selection. Use group to make them work like radio buttons, given the user can only choose one of each category.
The class MyApp must be derived from App.
class MyApp(App):
def build(self):
return Test()
Here is a little bit to help get you started:
from kivy.app import App
from kivy.lang import Builder
kv = """
TabbedPanel:
do_default_tab: False
TabbedPanelItem:
text: 'page1'
BoxLayout:
BoxLayout:
orientation:"vertical"
ToggleButton:
text: 'dog'
group: 'animal'
ToggleButton:
text: 'cat'
group: 'animal'
BoxLayout:
orientation:"vertical"
ToggleButton:
text: 'tea'
group: 'drink'
ToggleButton:
text: 'soda'
group: 'drink'
Button:
text: 'save'
TabbedPanelItem:
text: 'page2'
BoxLayout:
TextInput:
Button:
text: 'button'
"""
class MyApp(App):
def build(self):
return Builder.load_string(kv)
if __name__ == '__main__':
MyApp().run()
From: Vita
Sent: Saturday, May 23, 2020 9:05 AM
To: Kivy users support
Subject: [kivy-users] Want to print Text on the Button, and automaticallywrite(update) the value to a txt file
I am very beginner in making App and kivy
Thank you for your anticipated patience in this stupid question.
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/15410ef4-7b29-4053-a5c8-945a2dbb2d35%40googlegroups.com.