Get text from TextInput defined in .kv file from class The 2019 Stack Overflow Developer Survey Results Are InHow to get file creation & modification date/times in Python?Getting the class name of an instance?Why can't Python parse this JSON data?Importing files from different folderHow to read a text file into a string variable and strip newlines?why does right-clicking create an orange dot in the center of the circle?Get unique values from a list in pythonGet list from pandas DataFrame column headersCenter widgets in KivyKivy widgets behaving erratically

Loose spokes after only a few rides

What do the Banks children have against barley water?

Have you ever entered Singapore using a different passport or name?

Does the shape of a die affect the probability of a number being rolled?

How to manage monthly salary

Output the Arecibo Message

Geography at the pixel level

If a Druid sees an animal’s corpse, can they wild shape into that animal?

Why do we hear so much about the Trump administration deciding to impose and then remove tariffs?

Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?

Time travel alters history but people keep saying nothing's changed

Why do UK politicians seemingly ignore opinion polls on Brexit?

What is the motivation for a law requiring 2 parties to consent for recording a conversation

Identify This Plant (Flower)

Is "plugging out" electronic devices an American expression?

Is flight data recorder erased after every flight?

Multiply Two Integer Polynomials

Do these rules for Critical Successes and Critical Failures seem Fair?

Is there a symbol for a right arrow with a square in the middle?

Is this app Icon Browser Safe/Legit?

How to deal with fear of taking dependencies

Why is the maximum length of OpenWrt’s root password 8 characters?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

Why isn't airport relocation done gradually?



Get text from TextInput defined in .kv file from class



The 2019 Stack Overflow Developer Survey Results Are InHow to get file creation & modification date/times in Python?Getting the class name of an instance?Why can't Python parse this JSON data?Importing files from different folderHow to read a text file into a string variable and strip newlines?why does right-clicking create an orange dot in the center of the circle?Get unique values from a list in pythonGet list from pandas DataFrame column headersCenter widgets in KivyKivy widgets behaving erratically



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have the following code in python:



from kivy.app import App
from kivy.uix.widget import Widget
class UI(Widget):
pass

class UIApp(App):
def build(self):
return UI()

def process(self):
text = self.ids.input.text
print(text)


and in UI.kv:



#:kivy 1.0.9

<UI>:
title: 'InputDialog'
auto_dismiss: False
id: 'test1'

RelativeLayout:
orientation: 'vertical'
pos: self.pos
size: root.size
id: 'test2'

TextInput:
id: 'input'
hint_text:'Enter compounds'
pos_hint: 'center_x': 0.5, 'center_y': 0.705
size_hint: 0.95, 0.5


now if I call process() I get the error 'UIApp' object has no attribute 'ids'. Alright. Now I try replacing self with UI: AttributeError: 'kivy.properties.DictProperty' object has no attribute 'input'. Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file.



Is there a way to get the input from the field without creating this field programatically?










share|improve this question




























    0















    I have the following code in python:



    from kivy.app import App
    from kivy.uix.widget import Widget
    class UI(Widget):
    pass

    class UIApp(App):
    def build(self):
    return UI()

    def process(self):
    text = self.ids.input.text
    print(text)


    and in UI.kv:



    #:kivy 1.0.9

    <UI>:
    title: 'InputDialog'
    auto_dismiss: False
    id: 'test1'

    RelativeLayout:
    orientation: 'vertical'
    pos: self.pos
    size: root.size
    id: 'test2'

    TextInput:
    id: 'input'
    hint_text:'Enter compounds'
    pos_hint: 'center_x': 0.5, 'center_y': 0.705
    size_hint: 0.95, 0.5


    now if I call process() I get the error 'UIApp' object has no attribute 'ids'. Alright. Now I try replacing self with UI: AttributeError: 'kivy.properties.DictProperty' object has no attribute 'input'. Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file.



    Is there a way to get the input from the field without creating this field programatically?










    share|improve this question
























      0












      0








      0








      I have the following code in python:



      from kivy.app import App
      from kivy.uix.widget import Widget
      class UI(Widget):
      pass

      class UIApp(App):
      def build(self):
      return UI()

      def process(self):
      text = self.ids.input.text
      print(text)


      and in UI.kv:



      #:kivy 1.0.9

      <UI>:
      title: 'InputDialog'
      auto_dismiss: False
      id: 'test1'

      RelativeLayout:
      orientation: 'vertical'
      pos: self.pos
      size: root.size
      id: 'test2'

      TextInput:
      id: 'input'
      hint_text:'Enter compounds'
      pos_hint: 'center_x': 0.5, 'center_y': 0.705
      size_hint: 0.95, 0.5


      now if I call process() I get the error 'UIApp' object has no attribute 'ids'. Alright. Now I try replacing self with UI: AttributeError: 'kivy.properties.DictProperty' object has no attribute 'input'. Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file.



      Is there a way to get the input from the field without creating this field programatically?










      share|improve this question














      I have the following code in python:



      from kivy.app import App
      from kivy.uix.widget import Widget
      class UI(Widget):
      pass

      class UIApp(App):
      def build(self):
      return UI()

      def process(self):
      text = self.ids.input.text
      print(text)


      and in UI.kv:



      #:kivy 1.0.9

      <UI>:
      title: 'InputDialog'
      auto_dismiss: False
      id: 'test1'

      RelativeLayout:
      orientation: 'vertical'
      pos: self.pos
      size: root.size
      id: 'test2'

      TextInput:
      id: 'input'
      hint_text:'Enter compounds'
      pos_hint: 'center_x': 0.5, 'center_y': 0.705
      size_hint: 0.95, 0.5


      now if I call process() I get the error 'UIApp' object has no attribute 'ids'. Alright. Now I try replacing self with UI: AttributeError: 'kivy.properties.DictProperty' object has no attribute 'input'. Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file.



      Is there a way to get the input from the field without creating this field programatically?







      python kivy






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 9:13









      DodeiusDodeius

      358




      358






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Problem



          In your kv file, you have defined id as string.



          Kivy » Referencing Widgets




          Warning



          When assigning a value to id, remember that the value isn’t a string.
          There are no quotes: good -> id: value, bad -> id: 'value'




          Solution



          1. In your kv file, remove single quotes from all the id

          2. In your Python script, replace self.ids.input.text with self.root.ids.input.text because the ids were defined under the root, class UI()

          Example



          kv file



          #:kivy 1.0.9

          <UI>:
          title: 'InputDialog'
          auto_dismiss: False
          id: test1

          RelativeLayout:
          orientation: 'vertical'
          pos: self.pos
          size: root.size
          id: test2

          TextInput:
          id: input
          hint_text:'Enter compounds'
          pos_hint: 'center_x': 0.5, 'center_y': 0.705
          size_hint: 0.95, 0.5
          on_text: app.process()


          main.py



          from kivy.app import App
          from kivy.uix.widget import Widget
          from kivy.lang import Builder


          Builder.load_file('main.kv')


          class UI(Widget):
          pass


          class UIApp(App):
          def build(self):
          return UI()

          def process(self):
          text = self.root.ids.input.text
          print(text)


          if __name__ == "__main__":
          UIApp().run()


          Output



          Accesing textinput in kv file using ids






          share|improve this answer

























          • As I have stated in my post, "Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file."

            – Dodeius
            Mar 8 at 15:23











          • Please refer to updated post with Python script, on_text event in kv file, and print screen of output from method process().

            – ikolim
            Mar 8 at 15:29











          • <class '__main__.UI'> klklkijiojoij Works, the Builder seems to work better if placed in if __name__ == "__main__":

            – Dodeius
            Mar 8 at 22:00












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059957%2fget-text-from-textinput-defined-in-kv-file-from-class%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Problem



          In your kv file, you have defined id as string.



          Kivy » Referencing Widgets




          Warning



          When assigning a value to id, remember that the value isn’t a string.
          There are no quotes: good -> id: value, bad -> id: 'value'




          Solution



          1. In your kv file, remove single quotes from all the id

          2. In your Python script, replace self.ids.input.text with self.root.ids.input.text because the ids were defined under the root, class UI()

          Example



          kv file



          #:kivy 1.0.9

          <UI>:
          title: 'InputDialog'
          auto_dismiss: False
          id: test1

          RelativeLayout:
          orientation: 'vertical'
          pos: self.pos
          size: root.size
          id: test2

          TextInput:
          id: input
          hint_text:'Enter compounds'
          pos_hint: 'center_x': 0.5, 'center_y': 0.705
          size_hint: 0.95, 0.5
          on_text: app.process()


          main.py



          from kivy.app import App
          from kivy.uix.widget import Widget
          from kivy.lang import Builder


          Builder.load_file('main.kv')


          class UI(Widget):
          pass


          class UIApp(App):
          def build(self):
          return UI()

          def process(self):
          text = self.root.ids.input.text
          print(text)


          if __name__ == "__main__":
          UIApp().run()


          Output



          Accesing textinput in kv file using ids






          share|improve this answer

























          • As I have stated in my post, "Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file."

            – Dodeius
            Mar 8 at 15:23











          • Please refer to updated post with Python script, on_text event in kv file, and print screen of output from method process().

            – ikolim
            Mar 8 at 15:29











          • <class '__main__.UI'> klklkijiojoij Works, the Builder seems to work better if placed in if __name__ == "__main__":

            – Dodeius
            Mar 8 at 22:00
















          1














          Problem



          In your kv file, you have defined id as string.



          Kivy » Referencing Widgets




          Warning



          When assigning a value to id, remember that the value isn’t a string.
          There are no quotes: good -> id: value, bad -> id: 'value'




          Solution



          1. In your kv file, remove single quotes from all the id

          2. In your Python script, replace self.ids.input.text with self.root.ids.input.text because the ids were defined under the root, class UI()

          Example



          kv file



          #:kivy 1.0.9

          <UI>:
          title: 'InputDialog'
          auto_dismiss: False
          id: test1

          RelativeLayout:
          orientation: 'vertical'
          pos: self.pos
          size: root.size
          id: test2

          TextInput:
          id: input
          hint_text:'Enter compounds'
          pos_hint: 'center_x': 0.5, 'center_y': 0.705
          size_hint: 0.95, 0.5
          on_text: app.process()


          main.py



          from kivy.app import App
          from kivy.uix.widget import Widget
          from kivy.lang import Builder


          Builder.load_file('main.kv')


          class UI(Widget):
          pass


          class UIApp(App):
          def build(self):
          return UI()

          def process(self):
          text = self.root.ids.input.text
          print(text)


          if __name__ == "__main__":
          UIApp().run()


          Output



          Accesing textinput in kv file using ids






          share|improve this answer

























          • As I have stated in my post, "Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file."

            – Dodeius
            Mar 8 at 15:23











          • Please refer to updated post with Python script, on_text event in kv file, and print screen of output from method process().

            – ikolim
            Mar 8 at 15:29











          • <class '__main__.UI'> klklkijiojoij Works, the Builder seems to work better if placed in if __name__ == "__main__":

            – Dodeius
            Mar 8 at 22:00














          1












          1








          1







          Problem



          In your kv file, you have defined id as string.



          Kivy » Referencing Widgets




          Warning



          When assigning a value to id, remember that the value isn’t a string.
          There are no quotes: good -> id: value, bad -> id: 'value'




          Solution



          1. In your kv file, remove single quotes from all the id

          2. In your Python script, replace self.ids.input.text with self.root.ids.input.text because the ids were defined under the root, class UI()

          Example



          kv file



          #:kivy 1.0.9

          <UI>:
          title: 'InputDialog'
          auto_dismiss: False
          id: test1

          RelativeLayout:
          orientation: 'vertical'
          pos: self.pos
          size: root.size
          id: test2

          TextInput:
          id: input
          hint_text:'Enter compounds'
          pos_hint: 'center_x': 0.5, 'center_y': 0.705
          size_hint: 0.95, 0.5
          on_text: app.process()


          main.py



          from kivy.app import App
          from kivy.uix.widget import Widget
          from kivy.lang import Builder


          Builder.load_file('main.kv')


          class UI(Widget):
          pass


          class UIApp(App):
          def build(self):
          return UI()

          def process(self):
          text = self.root.ids.input.text
          print(text)


          if __name__ == "__main__":
          UIApp().run()


          Output



          Accesing textinput in kv file using ids






          share|improve this answer















          Problem



          In your kv file, you have defined id as string.



          Kivy » Referencing Widgets




          Warning



          When assigning a value to id, remember that the value isn’t a string.
          There are no quotes: good -> id: value, bad -> id: 'value'




          Solution



          1. In your kv file, remove single quotes from all the id

          2. In your Python script, replace self.ids.input.text with self.root.ids.input.text because the ids were defined under the root, class UI()

          Example



          kv file



          #:kivy 1.0.9

          <UI>:
          title: 'InputDialog'
          auto_dismiss: False
          id: test1

          RelativeLayout:
          orientation: 'vertical'
          pos: self.pos
          size: root.size
          id: test2

          TextInput:
          id: input
          hint_text:'Enter compounds'
          pos_hint: 'center_x': 0.5, 'center_y': 0.705
          size_hint: 0.95, 0.5
          on_text: app.process()


          main.py



          from kivy.app import App
          from kivy.uix.widget import Widget
          from kivy.lang import Builder


          Builder.load_file('main.kv')


          class UI(Widget):
          pass


          class UIApp(App):
          def build(self):
          return UI()

          def process(self):
          text = self.root.ids.input.text
          print(text)


          if __name__ == "__main__":
          UIApp().run()


          Output



          Accesing textinput in kv file using ids







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 9 at 0:17

























          answered Mar 8 at 15:10









          ikolimikolim

          7,8351824




          7,8351824












          • As I have stated in my post, "Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file."

            – Dodeius
            Mar 8 at 15:23











          • Please refer to updated post with Python script, on_text event in kv file, and print screen of output from method process().

            – ikolim
            Mar 8 at 15:29











          • <class '__main__.UI'> klklkijiojoij Works, the Builder seems to work better if placed in if __name__ == "__main__":

            – Dodeius
            Mar 8 at 22:00


















          • As I have stated in my post, "Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file."

            – Dodeius
            Mar 8 at 15:23











          • Please refer to updated post with Python script, on_text event in kv file, and print screen of output from method process().

            – ikolim
            Mar 8 at 15:29











          • <class '__main__.UI'> klklkijiojoij Works, the Builder seems to work better if placed in if __name__ == "__main__":

            – Dodeius
            Mar 8 at 22:00

















          As I have stated in my post, "Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file."

          – Dodeius
          Mar 8 at 15:23





          As I have stated in my post, "Trying to adress 'test1' also didn't help, neither did removing the ' around the ids in the .kv file."

          – Dodeius
          Mar 8 at 15:23













          Please refer to updated post with Python script, on_text event in kv file, and print screen of output from method process().

          – ikolim
          Mar 8 at 15:29





          Please refer to updated post with Python script, on_text event in kv file, and print screen of output from method process().

          – ikolim
          Mar 8 at 15:29













          <class '__main__.UI'> klklkijiojoij Works, the Builder seems to work better if placed in if __name__ == "__main__":

          – Dodeius
          Mar 8 at 22:00






          <class '__main__.UI'> klklkijiojoij Works, the Builder seems to work better if placed in if __name__ == "__main__":

          – Dodeius
          Mar 8 at 22:00




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55059957%2fget-text-from-textinput-defined-in-kv-file-from-class%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович