Python Forum
[Kivy] output label
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Kivy] output label
#1
Hi everyone,

I'm new to kivy and I'm trying to do something very simple that I can't get right and can't find any information anywhere. All I want to do is open a window that contains a text input and a submit button, and all the program needs to do is fetch the input typed in by the user and when you click the submit button it must show that information in an output label. This is what I have so far:
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.base import runTouchApp
from kivy.uix.boxlayout import BoxLayout
from kivy.core.window import Window
from kivy.uix.spinner import Spinner
from kivy.properties import StringProperty

layout = GridLayout(cols=2, rows=8, row_force_default=True, row_default_height=40, spacing=10, padding=20)

class MyApp(App):
    def build(self):
        Window.clearcolor = (136 / 255, 46 / 255, 138 / 255, 1)
        Window.size = (300, 600)

        self.input_from = TextInput()
        layout.add_widget(self.input_from)

        # create submit button
        self.submit_button = Button(text='Submit', on_press=self.submit_button)
        layout.add_widget(self.submit_button)

        self.label_output = Label(text=self.input_from)
        layout.add_widget(self.label_output)
        return layout


MyApp().run()


The issue I am having is with the output label that isn't working. Any help or guidance would be highly appreciated.
Thanks a lot
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020