久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='8nDfi'></tfoot>

    1. <small id='8nDfi'></small><noframes id='8nDfi'>

      1. <i id='8nDfi'><tr id='8nDfi'><dt id='8nDfi'><q id='8nDfi'><span id='8nDfi'><b id='8nDfi'><form id='8nDfi'><ins id='8nDfi'></ins><ul id='8nDfi'></ul><sub id='8nDfi'></sub></form><legend id='8nDfi'></legend><bdo id='8nDfi'><pre id='8nDfi'><center id='8nDfi'></center></pre></bdo></b><th id='8nDfi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8nDfi'><tfoot id='8nDfi'></tfoot><dl id='8nDfi'><fieldset id='8nDfi'></fieldset></dl></div>
        <legend id='8nDfi'><style id='8nDfi'><dir id='8nDfi'><q id='8nDfi'></q></dir></style></legend>
          <bdo id='8nDfi'></bdo><ul id='8nDfi'></ul>

      2. 在 __init__ word=self.search_box.text AttributeError: 'N

        in __init__ word=self.search_box.text AttributeError: #39;NoneType#39; object has no attribute #39;text#39;(在 __init__ word=self.search_box.text AttributeError: NoneType 對象沒有屬性 text)

              <tbody id='5AnrH'></tbody>
            <i id='5AnrH'><tr id='5AnrH'><dt id='5AnrH'><q id='5AnrH'><span id='5AnrH'><b id='5AnrH'><form id='5AnrH'><ins id='5AnrH'></ins><ul id='5AnrH'></ul><sub id='5AnrH'></sub></form><legend id='5AnrH'></legend><bdo id='5AnrH'><pre id='5AnrH'><center id='5AnrH'></center></pre></bdo></b><th id='5AnrH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5AnrH'><tfoot id='5AnrH'></tfoot><dl id='5AnrH'><fieldset id='5AnrH'></fieldset></dl></div>
            • <bdo id='5AnrH'></bdo><ul id='5AnrH'></ul>
            • <small id='5AnrH'></small><noframes id='5AnrH'>

                  <tfoot id='5AnrH'></tfoot>

                  <legend id='5AnrH'><style id='5AnrH'><dir id='5AnrH'><q id='5AnrH'></q></dir></style></legend>

                1. 本文介紹了在 __init__ word=self.search_box.text AttributeError: 'NoneType' 對象沒有屬性 'text'的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在制作一個應用程序.據我所知,我做的事情正確,但仍然出現此錯誤

                  I am making an application.as far as I know I am doing thingd correctly but still getting this error

                  word=self.search_box.textAttributeError: 'NoneType' 對象沒有屬性 'text'

                  word=self.search_box.text AttributeError: 'NoneType' object has no attribute 'text'

                  我已經檢查了拼寫錯誤和其他常見錯誤,但仍然無法正常工作.

                  I have checked for typos and other common mistakes still its not working.

                  這是代碼-

                  import kivy
                  kivy.require('1.10.0')
                  
                  from kivy.uix.stacklayout import StackLayout
                  from kivy.uix.floatlayout import FloatLayout
                  from kivy.uix.boxlayout import BoxLayout
                  from kivy.uix.label import Label 
                  from kivy.app import App
                  from kivy.uix.popup import Popup  
                  from kivy.uix.screenmanager import ScreenManager, Screen 
                  from kivy.lang import Builder 
                  from kivy.properties import ObjectProperty
                  from kivy.uix.textinput import TextInput
                  from kivy.properties import StringProperty
                  
                  
                  import json
                  
                  Builder.load_file('VocabularyJournal.kv')
                  
                  class MenuPage(Screen):
                      pass
                  
                  class DisplayPage(Screen):
                      search_box= ObjectProperty()
                      label_maening=StringProperty()
                      label_synonym=StringProperty()
                      label_ant=StringProperty()
                      label_sentence=StringProperty()
                  
                  
                      def __init__(self, **kwargs):
                          super(DisplayPage,self).__init__(**kwargs)
                          with open('vocab_words.json') as rfile:
                              data=json.load(rfile)
                  
                          word=self.search_box.text               #the error occurred here 
                  
                          for value in data:
                              if value['word']==word:
                                  self.label_maening=value['meaning']
                                  self.label_synonym=value['synonym']
                                  self.label_ant=value['antonyms']
                                  self.label_sentence=value['sentence']
                  
                  
                  class WordInsertPage(Screen):
                      pass
                  
                  
                  class NewWordPage(Screen):
                      word_box = ObjectProperty()
                      meaning_box = ObjectProperty()
                      synonym_box = ObjectProperty()
                      ant_box = ObjectProperty()
                      sentence_box = ObjectProperty()
                  
                  
                      def saving_data(self):
                  
                          with open('vocab_words.json') as rfile:
                              data=json.load(rfile)
                  
                  
                          entry={'word': self.word_box.text, 'meaning': self.meaning_box.text, 'synonym': self.synonym_box.text, 'antonyms': self.ant_box.text, 'sentence': self.sentence_box.text}
                          data.append(entry)
                  
                  
                          with open('vocab_words.json','w') as wfile:
                              json.dump(data,wfile,indent=4)
                  
                  
                  class FlashCard(Screen):
                      pass
                  
                  class WordGroups(Screen):
                      pass
                  
                  class Manager(ScreenManager):
                      pass
                  
                  class VocabularyJournalApp(App):
                      def build(self):
                          return Manager()
                  
                  object = VocabularyJournalApp()
                  object.run()
                  

                  這是kv代碼-

                  <Manager>:
                      MenuPage:
                          name: 'menu'
                      WordInsertPage:
                          name: 'insertword'
                      NewWordPage:
                          name: 'newword'
                      FlashCard:
                          name: 'flashcard'
                      WordGroups:
                          name: 'wordgroup'
                      DisplayPage:
                          name: 'display'
                  
                  <MenuPage>:
                      Label: 
                          text: "Vocabulary Journal"
                          size_hint: .90,.10
                  
                      StackLayout:
                          orientation: 'tb-rl'
                          spacing: 10
                          padding: 10
                  
                          Button:
                              text: 'Search'
                              size_hint: None,.20
                              width: 130
                              background_down:'darkgrey.png'
                              on_press: root.manager.current='insertword'
                          Button:
                              text: 'New Word'
                              size_hint: None,.20
                              width: 130
                              background_down:'darkgrey.png'
                              on_press: root.manager.current='insertword'
                          Button:
                              text: 'Flash Cards'
                              size_hint: None,.20
                              width: 130
                              background_down:'darkgrey.png'
                              on_press: root.manager.current='flashcard'
                  
                          Button:
                              text: 'Word Groups'
                              size_hint: None,.20
                              width: 130
                              background_down:'darkgrey.png'
                              on_press: root.manager.current='wordgroup'
                  
                  <WordInsertPage>:
                  
                      FloatLayout:
                  
                          Button: 
                              text: "New Word"
                              on_press: root.manager.current='newword'
                              font_size: 30
                              color: 0,0,0,1
                              size_hint: .2, .1
                              pos_hint: {"center_x": .5, "center_y": 0.3}
                              background_down: 'darkgrey.png'
                          Button:
                              text: "search word"
                              on_press: root.manager.current='display'
                              font_size: 30
                              color: 0,0,0,1
                              size_hint: .2, .1
                              pos_hint: {"center_x": .5, "center_y": 0.5}
                              background_down: 'darkgrey.png'
                          Button:
                              text: 'Flash Cards'
                              on_press: root.manager.current="flashcard"
                              font_size: 30
                              color: 0,0,0,1
                              size_hint: .2, .1
                              pos_hint: {"center_x": .5, "center_y": 0.7}
                              background_down: 'darkgrey.png'
                  
                  
                  
                  <NewWordPage>:
                      id: refer_to_it
                      word_box: word_input
                      meaning_box: meaning_input
                      synonym_box: Synonym_input
                      ant_box: ant_input
                      sentence_box: sentence_input
                      StackLayout:
                          orientation: 'tb-rl'
                          spacing: 10
                          padding: 90
                          TextInput:
                              text: "write your word here"
                              color: 1,1,1,1
                              id: word_input
                              width: 300
                              size_hint: None, .10
                  
                          TextInput:
                              text: "write meaning of your word here"
                              color: 1,1,1,1
                              id: meaning_input
                              width: 600
                              size_hint: None, .20
                  
                          TextInput:
                              text: "write Synonyms of your word here"
                              color: 1,1,1,1
                              id: Synonym_input
                              width: 600
                              size_hint: None, .20
                  
                          TextInput:
                              text: "write antonyms of your text here"
                              color: 1,1,1,1
                              id: ant_input
                              width: 600
                              size_hint: None, .20
                  
                          TextInput:
                              text: "write a sentence based on your word here"
                              color: 1,1,1,1
                              id: sentence_input
                              width: 600
                              size_hint: None, .20
                  
                          Button:
                              text: 'Save'
                              size_hint: None,.10
                              width: 130
                              background_down:'darkgrey.png'
                              on_press: refer_to_it.saving_data()     
                  
                  <DisplayPage>:
                      search_box: search_text  # search_box is the reference to the textinput in py file
                      BoxLayout:
                          size_hint_y: None
                          height: '48dp'
                  
                          TextInput:
                              text:'enter the word you wanna search here'
                              id: search_text
                  
                  
                          ToggleButton:
                              id: tog
                              text: 'Horizontal'
                              group: 'accordion'
                              state: 'down'
                  
                          ToggleButton:
                              text: 'Vertical'
                              group: 'accordion'
                  
                      Accordion:
                          orientation: 'horizontal' if tog.state == 'down' else 'vertical'    
                  
                          AccordionItem:
                              title:'meaning'
                  
                              Label:
                                  text: root.label_maening
                                  text_size: self.width, None
                  
                          AccordionItem:
                              title:'Synonym'
                  
                              Label:
                                  text: root.label_synonym
                                  text_size: self.width, None
                  
                          AccordionItem:
                              title:'Antonym'
                  
                              Label:
                                  text: root.label_ant
                                  text_size: self.width, None
                  
                          AccordionItem:
                              title:'Sentence'
                  
                              Label:
                                  text: root.label_sentence
                                  text_size: self.width, None
                  

                  推薦答案

                  這個問題是因為children沒有卡在parent的構造函數中,它稍后會卡住所以search_box在構造函數中會是None,解決方案是在 Clock 的幫助下完成構造函數后立即執行它:

                  the problem is caused because the children are not stuck in the constructor of the parent, it does it an instant later so search_box will be None in the constructor, the solution is to execute it an instant after finishing the constructor with the help of Clock:

                  from kivy.clock import Clock
                  
                  
                  class DisplayPage(Screen):
                      search_box= ObjectProperty()
                      label_maening=StringProperty()
                      label_synonym=StringProperty()
                      label_ant=StringProperty()
                      label_sentence=StringProperty()
                  
                  
                      def __init__(self, **kwargs):
                          super(DisplayPage,self).__init__(**kwargs)
                          Clock.schedule_once(self.callback)
                  
                      def callback(self, dt):
                          with open('vocab_words.json') as rfile:
                              data=json.load(rfile)
                  
                          word=self.search_box.text               #the error occurred here 
                  
                          for value in data:
                              if value['word']==word:
                                  self.label_maening=value['meaning']
                                  self.label_synonym=value['synonym']
                                  self.label_ant=value['antonyms']
                                  self.label_sentence=value['sentence']
                  

                  這篇關于在 __init__ word=self.search_box.text AttributeError: 'NoneType' 對象沒有屬性 'text'的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)
                  • <i id='hYPl0'><tr id='hYPl0'><dt id='hYPl0'><q id='hYPl0'><span id='hYPl0'><b id='hYPl0'><form id='hYPl0'><ins id='hYPl0'></ins><ul id='hYPl0'></ul><sub id='hYPl0'></sub></form><legend id='hYPl0'></legend><bdo id='hYPl0'><pre id='hYPl0'><center id='hYPl0'></center></pre></bdo></b><th id='hYPl0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hYPl0'><tfoot id='hYPl0'></tfoot><dl id='hYPl0'><fieldset id='hYPl0'></fieldset></dl></div>

                      <bdo id='hYPl0'></bdo><ul id='hYPl0'></ul>
                      • <legend id='hYPl0'><style id='hYPl0'><dir id='hYPl0'><q id='hYPl0'></q></dir></style></legend>

                          <tfoot id='hYPl0'></tfoot>

                          <small id='hYPl0'></small><noframes id='hYPl0'>

                              <tbody id='hYPl0'></tbody>
                            主站蜘蛛池模板: 国产精品日韩一区二区 | 国产综合第一页 | 亚洲国产一区二区在线 | 欧美一区二区在线播放 | 国产女人与拘做受视频 | 蜜臀久久99精品久久久久久宅男 | 国产精品亚洲一区二区三区在线 | 福利一区二区 | 成人免费淫片aa视频免费 | 国产一级片精品 | 久久久久国产一级毛片高清网站 | www.亚洲 | 亚洲精品久久国产高清情趣图文 | 国产精品午夜电影 | 视频在线观看一区 | 操人视频在线观看 | 国产成人精品免高潮在线观看 | 色姑娘综合网 | 99热视 | 伊人91在线 | 亚洲精品专区 | 亚洲a在线视频 | 欧美综合久久 | 久久久噜噜噜www成人网 | 在线小视频 | 亚洲综合大片69999 | 亚洲av毛片成人精品 | 视频1区| 国产丝袜一区二区三区免费视频 | 美女视频一区二区三区 | 精品欧美一区二区三区 | 成人在线电影在线观看 | 日韩中文在线观看 | 999国产精品视频免费 | 伊人狼人影院 | 亚洲日韩中文字幕 | a在线观看| 欧美久久一区二区 | 中文字幕久久精品 | 男人天堂手机在线视频 | 成人做爰9片免费看网站 |