Seite 2 von 7
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 18:36
von sls
Das modul heißt requests.
EDIT:
Übersehen dass du urllib verwendest:
Code: Alles auswählen
with urllib.request.urlopen(URL + "/Versionen/latest.vers") as response:
prices = request.read().decode(request.headers.get_content_charset() or "ASCII")
Du willst doch wissen, was response liefert. request alleine ist sinnlos.
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 18:39
von MupfSpace
sorry ich hab auch in meinem Code requests nur hier hab ich mich vertippt
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 18:44
von sls
Du lädst die Ressource als "response", d.h. du musst auch von diesem Objekt (Antwort) "lesen". Nicht von request (was überhaupt keinen sinn macht, vor allem weil request an urllib gebunden ist)
prices = response.read()....
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 19:13
von MupfSpace
Sirius3 hat geschrieben: Samstag 26. Januar 2019, 23:01
def update_prices(self, url, labels):
with urllib.request.urlopen(URL + url) as response:
prices = response.read().decode(response.headers.get_content_charset() or "ASCII")
for label, price in zip(label, prices.split(';')):
label.text = price
erwas verstehe ich noch nicht daran
was bedeutet
und ausserdem bekomme ich den fehler:
Code: Alles auswählen
[INFO ] [Logger ] Record log in C:\Users\MupfSpace\.kivy\logs\kivy_19-01-28_14.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.5.0 - Build 22.20.16.4771'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) HD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 5
[INFO ] [GL ] Shading version <b'4.50 - Build 22.20.16.4771'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Text ] Provider: sdl2
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\uix\listview.py line 845.Called from C:\Python37\lib\site-packages\kivy\lang\builder.py line 582 by _apply_rule().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\simplelistadapter.py line 49.Called from C:\Python37\lib\site-packages\kivy\uix\listview.py line 859 by __init__().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\adapter.py line 111.Called from C:\Python37\lib\site-packages\kivy\adapters\simplelistadapter.py line 55 by __init__().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\uix\abstractview.py line 42.Called from C:\Python37\lib\site-packages\kivy\uix\listview.py line 865 by __init__().
[INFO ] [GL ] NPOT texture support is available
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\listadapter.py line 185.Called from <string> line 433 by <module>().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\adapter.py line 111.Called from C:\Python37\lib\site-packages\kivy\adapters\listadapter.py line 186 by __init__().
Traceback (most recent call last):
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py", line 45, in <module>
main(ptvsdArgs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__main__.py", line 265, in main
wait=args.wait)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__main__.py", line 256, in handle_args
run_main(addr, name, kind, *extra, **kwargs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_local.py", line 52, in run_main
runner(addr, name, kind == 'module', *extra, **kwargs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\runner.py", line 32, in run
set_trace=False)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1283, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1290, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 784, in <module>
main()
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 781, in main
app.run()
File "C:\Python37\lib\site-packages\kivy\app.py", line 825, in run
self.dispatch('on_start')
File "kivy\_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 744, in on_start
ids.sorte5, ids.preis5,
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 729, in update_prices
for label, price in zip(label, prices.split(';')):
UnboundLocalError: local variable 'label' referenced before assignment
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 19:24
von sls
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 19:28
von sls
Mit zip() kann man ganz tolle Sachen machen. z.B. iterierbare Objekte zusammenfügen. All so magisches Zeug eben.
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 19:34
von MupfSpace
ja fast geschaft einen Error geibt es nur noch zu beheben(wäre doch gelacht wenn wir den nicht auch noch behebne können

):
nach den 30 Sekunden die die Clock warten soll kommt der error:
Code: Alles auswählen
[INFO ] [Logger ] Record log in C:\Users\MupfSpace\.kivy\logs\kivy_19-01-28_19.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.5.0 - Build 22.20.16.4771'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) HD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 5
[INFO ] [GL ] Shading version <b'4.50 - Build 22.20.16.4771'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Text ] Provider: sdl2
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\uix\listview.py line 845.Called from C:\Python37\lib\site-packages\kivy\lang\builder.py line 582 by _apply_rule().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\simplelistadapter.py line 49.Called from C:\Python37\lib\site-packages\kivy\uix\listview.py line 859 by __init__().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\adapter.py line 111.Called from C:\Python37\lib\site-packages\kivy\adapters\simplelistadapter.py line 55 by __init__().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\uix\abstractview.py line 42.Called from C:\Python37\lib\site-packages\kivy\uix\listview.py line 865 by __init__().
[INFO ] [GL ] NPOT texture support is available
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\listadapter.py line 185.Called from <string> line 433 by <module>().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\adapter.py line 111.Called from C:\Python37\lib\site-packages\kivy\adapters\listadapter.py line 186 by __init__().
[INFO ] [Base ] Start application main loop
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\uix\selectableview.py line 38.Called from C:\Python37\lib\site-packages\kivy\uix\listview.py line 593 by __init__().
[INFO ] [Base ] Leaving application in progress...
Traceback (most recent call last):
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py", line 45, in <module>
main(ptvsdArgs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__main__.py", line 265, in main
wait=args.wait)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__main__.py", line 256, in handle_args
run_main(addr, name, kind, *extra, **kwargs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_local.py", line 52, in run_main
runner(addr, name, kind == 'module', *extra, **kwargs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\runner.py", line 32, in run
set_trace=False)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1283, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1290, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 784, in <module>
main()
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 781, in main
app.run()
File "C:\Python37\lib\site-packages\kivy\app.py", line 826, in run
runTouchApp()
File "C:\Python37\lib\site-packages\kivy\base.py", line 502, in runTouchApp
EventLoop.window.mainloop()
File "C:\Python37\lib\site-packages\kivy\core\window\window_sdl2.py", line 727, in mainloop
self._mainloop()
File "C:\Python37\lib\site-packages\kivy\core\window\window_sdl2.py", line 460, in _mainloop
EventLoop.idle()
File "C:\Python37\lib\site-packages\kivy\base.py", line 337, in idle
Clock.tick()
File "C:\Python37\lib\site-packages\kivy\clock.py", line 581, in tick
self._process_events()
File "kivy\_clock.pyx", line 384, in kivy._clock.CyClockBase._process_events
File "kivy\_clock.pyx", line 414, in kivy._clock.CyClockBase._process_events
File "kivy\_clock.pyx", line 412, in kivy._clock.CyClockBase._process_events
File "kivy\_clock.pyx", line 167, in kivy._clock.ClockEvent.tick
TypeError: on_start() takes 1 positional argument but 2 were given
aber die App startet sich schon mal
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 19:38
von sls
Welchen Code hast du dir denn jetzt zusammengekleistert? Das Beispiel von Sirius3?
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 19:42
von MupfSpace
Ich hab ein paar Dinge geändert wie zum Beispiel Request zu response
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 19:52
von sls
Also, ich nehme mal an der Code schaut immer noch so aus:
Probier' mal:
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 20:09
von MupfSpace
Code: Alles auswählen
Purge log fired. Analysing...
Purge 33 log files
Purge finished!
[INFO ] [Logger ] Record log in C:\Users\MupfSpace\.kivy\logs\kivy_19-01-28_25.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.5.0 - Build 22.20.16.4771'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) HD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 5
[INFO ] [GL ] Shading version <b'4.50 - Build 22.20.16.4771'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Text ] Provider: sdl2
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\uix\listview.py line 845.Called from C:\Python37\lib\site-packages\kivy\lang\builder.py line 582 by _apply_rule().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\simplelistadapter.py line 49.Called from C:\Python37\lib\site-packages\kivy\uix\listview.py line 859 by __init__().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\adapter.py line 111.Called from C:\Python37\lib\site-packages\kivy\adapters\simplelistadapter.py line 55 by __init__().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\uix\abstractview.py line 42.Called from C:\Python37\lib\site-packages\kivy\uix\listview.py line 865 by __init__().
[INFO ] [GL ] NPOT texture support is available
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\listadapter.py line 185.Called from <string> line 433 by <module>().
[WARNING] [Call to deprecated function __init__ in C]\Python37\lib\site-packages\kivy\adapters\adapter.py line 111.Called from C:\Python37\lib\site-packages\kivy\adapters\listadapter.py line 186 by __init__().
Traceback (most recent call last):
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py", line 45, in <module>
main(ptvsdArgs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__main__.py", line 265, in main
wait=args.wait)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\__main__.py", line 256, in handle_args
run_main(addr, name, kind, *extra, **kwargs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_local.py", line 52, in run_main
runner(addr, name, kind == 'module', *extra, **kwargs)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\runner.py", line 32, in run
set_trace=False)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1283, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\pydevd.py", line 1290, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "c:\Users\MupfSpace\.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 784, in <module>
main()
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 781, in main
app.run()
File "C:\Python37\lib\site-packages\kivy\app.py", line 825, in run
self.dispatch('on_start')
File "kivy\_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
TypeError: on_start() missing 1 required positional argument: 'dt'
ich bin schön langsam wirklich am verzeifeln
heul heul heul
villeicht habe ich ja etwas an sirius beispiel falsch verändert:
mein aktueller code lautet...
Code: Alles auswählen
class TankstellenApp(App):
def __init__(self):
super().__init__()
self.blink = True
self.update = False
def cheap_not_switched(self, instance, value):
if value:
notification.notify(message="Du erhälst ab jetzt Benachrichtigungem bei günstigem Preis!\n"
"Du kannst in den Einstellungen die Preise verändern bei denen du Benachrichtigugen erhalten willst!")
with open(os.path.join(APP_PATH, "CheapNotify.val", "w")) as output:
output.write(str(value))
@staticmethod
def download_files():
if not os.path.exists(APP_PATH):
with urllib.request.urlopen(URL + "/Appfiles/files.zip") as response:
data = BytesIO(response.read())
with ZipFile(data) as files:
files.extractall(STORAGE)
def check_version(self):
with urllib.request.urlopen(URL + "/Versionen/latest.vers") as response:
version = response.read().decode(response.headers.get_content_charset() or "ASCII")
with open(os.path.join(APP_PATH, "vers")) as data:
current_version = data.read()
self.update = version != current_version
def update_prices(self, url, labels):
with urllib.request.urlopen(URL + url) as response:
prices = response.read().decode(response.headers.get_content_charset() or "ASCII")
for label, price in zip(labels, prices.split(';')):
label.text = price
def on_start(self, dt):
self.root.ids.refBUT.background_color=(0,0,0,0) if self.blink else (0,0,9,9)
self.blink = not self.blink
self.download_files()
self.check_version()
self.root.ids.UpdInf.pos_hint = {'bottom' if self.update else 'top': 1}
ids = self.root.ids
self.update_prices("/PreisErmitlung/OMVNBB.pri", [
ids.sorte1, ids.preis1,
ids.sorte2, ids.preis2,
ids.sorte3, ids.preis3,
ids.sorte4, ids.preis4,
ids.sorte5, ids.preis5,
])
self.update_prices("/PreisErmitlung/DRIVERSINPB.pri", [
ids.sorte1DVP, ids.preis1DVP,
ids.sorte2DVP, ids.preis2DVP,
ids.sorte3DVP, ids.preis3DVP,
ids.sorte4DVP, ids.preis4DVP,
ids.sorte5DVP, ids.preis5DVP,
])
self.update_prices("/PreisErmitlung/SHELLKGB.pri", [
ids.sorte1KGS, ids.preis1KGS,
ids.sorte2KGS, ids.preis2KGS,
ids.sorte3KGS, ids.preis3KGS,
ids.sorte4KGS, ids.preis4KGS,
ids.sorte5KGS, ids.preis5KGS,
ids.sorte6KGS, ids.preis6KGS,
])
def updateinfo_gone(self, ActionPrevious):
self.root.ids.UpdInf.pos_hint={'top':1}
def version_selected(self, ListItemButton):
print("^")
def build(self):
self.settings_cls = SettingsWithSidebar
self.use_kivy_settings= False
return g
def build_config(self, config):
self.config.setdefaults('settings',{"AutoUpdate": True})
def build_settings(self,settings):
settings.add_json_panel('Einstellungen', self.config, data=setting_json)
def main():
app = TankstellenApp()
Clock.schedule_interval(app.on_start, 30)
app.run()
if __name__ == '__main__':
main()
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 20:58
von sls
Laut Doku sollte es klappen. Vielleicht ist meine Lösung auch keine, weil ich die Doku nicht verstanden habe.
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 21:29
von MupfSpace
Für was ist dt überhaupt da.
Kann ich die Doku mal sehen(link)?
Ich hab aber sirius Code schon richtig bearbeitet oder?
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Montag 28. Januar 2019, 21:41
von sls
Clock.schedule_interval erwartet als ersten Parameter den callback, also die Funktion / Methode die aufgerufen werden soll, hier on_start. Als zweiter Parameter wird das Timeout übergeben, also die Zeit in Sekunden in der der callback aufgerufen werden soll. Irgendwie scheint das Ding on_start(self) als Argument zu erkennen. Den Link zur Doku habe ich dir hier im Thread schon geteilt.
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Dienstag 29. Januar 2019, 07:08
von MupfSpace
Aber warum geht das nicht?
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Dienstag 29. Januar 2019, 08:07
von Sirius3
`on_start` benutzt Du als Clock-Callback, in Wirklichkeit ist das aber ein Hook, der beim Start der Application aufgerufen wird.
Aus meiner Sicht zeigst Du gerade zu wenig Eigeninitiative, sondern fragst gleich bei jedem kleinen Problem.
Der Code, den ich gepostet habe, sollte nur lange Erklärungen illustrieren, weil manche Konzepte am besten am Code gesehen werden können. Deine Aufgabe ist es, alles zu verstehen, anstatt nur zu kopieren. Dazu gehört auch, die Kivy-Dokumentation zu lesen:
https://kivy.org/doc/stable/api-kivy.app.html
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Dienstag 29. Januar 2019, 16:38
von MupfSpace
Ich habe den Code sowohl versucht zu verstehen als auch zu größten Teil verstanden.
Ich habe auch sehr viele Probleme gelöst ohne hier zu fragen.
Es soll nicht so wirken als ob ich keine Eigeninitiative zeigen würde.
Ich habe jeden Fehler zu erst selber versucht zu beheben und erst gefragt wenn ich keine Lösung gefunden habe.
Es würde keinen Sinn ergeben den Code nur zu kopieren und ihn nicht zu verstehen deshalb habe ich ihn mir auch angesehen und dann bearbeitet und verstanden.
...
Ich habe gerade in der kivy Dokumentation nachgesehen aber nichts gefunden was mir weiter helfen könnte.
Ich habe danach auch Verschiedenes im Internet nachgesehen und selber ein paar Dinge ausprobiert habe aber keine Lösung gefunden.
Ich habe sehr viel ausprobiert und bin immer noch auf keine Lösung gekommen deshalb würde ich euch gerne noch einmal um Hilfe bitten..
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Dienstag 29. Januar 2019, 16:51
von __blackjack__
@MupfSpace: Das `on_start()` die falsche Methode ist um wiederholt aufgerufen zu werden weil das die Methode ist die beim Start *einmal* aufgerufen wird, hatte ich Dir aber auch schon mal geschrieben. Das `Clock.schedule_interval()` wäre beispielsweise etwas was eigentlich *in* diese Methode gehört, weil das ja beim Start der Anwendung gemacht werden soll. Die `on_start()`-Methode wird beim Start der App vom Rahmenwerk aufgerufen. Und dabei wird *kein* Argument übergeben. Deine `on_start()` erwartet aber ein Argument – bekommt es nicht und das kracht dann halt. Das die Methode keine Argumente erwartet sieht man in der Dokumentation.
Was die Rückruffunktion als Argument bekommt und auch wie man eine aufruft die kein Argument bekommen soll, steht ebenfalls in der Dokumentation (vom `kivy.clock`-Modul – mit Codebeispiel. Wobei wie gesagt `on_start()` die falsche Methode als Rückrufziel ist, auch wenn man das `dt`-Argument beseitigt.
Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Dienstag 29. Januar 2019, 17:37
von MupfSpace
okay ich habe mir jetzt den Code aus der on_start() Funktion kopiert(sorry, ich hab zwar vorher gesagt ich mache das nicht aber das alles noch mal neu zu schrieben ist irrsinnig)
und zum größten teil(eigentlich alles bis auf "blink") eingefügt.
und habe dann gesagt
und es funktioniert
________________________________________________________________
Dake für eure hilfe

Re: Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Verfasst: Samstag 2. Februar 2019, 13:56
von MupfSpace
so ich hab jetzt Ewigkeiten rum probiert und keine Möglichkeit gefunden.
gibt es auch eine Möglichkeit
wieder zu beenden?