Kivy AttributeError: 'NoneType' object has no attribute 'ids'
Das sollte auch nicht das gesamte Programm sein, sondern nur die Teile, die einer dringenden Überarbeitung bedürfen. Wie ich gerade sehe, hat mein Editor ein paar falsche Einrückungen von Dir mit übernommen. Man sollte wirklich keine Tabs und Leerzeichen mischen.
das mit den Einrückungen habe ich gemerkt und wieder richtig gemacht und ich weis auch das das nicht das ganze Programm ist sondern nur ein teil und ich habe ihn auch an die richtige stelle gesetzt.
und als ich das programm dan gestartet habe hab ich den:
fehler brkommen.
und als ich das programm dan gestartet habe hab ich den:
Code: Alles auswählen
AttributeError: 'TankstellenApp' object has no attribute 'built'
MupfSpace hat geschrieben: Sonntag 27. Januar 2019, 10:44 das mit den Einrückungen habe ich gemerkt und wieder richtig gemacht und ich weis auch das das nicht das ganze Programm ist sondern nur ein teil und ich habe ihn auch an die richtige stelle gesetzt.
und als ich das programm dan gestartet habe hab ich den:fehler brkommen.Code: Alles auswählen
AttributeError: 'TankstellenApp' object has no attribute 'built'
Was kann ich dagegen Tun?
hier der verbesserte Code:
und hier fer gesammte Traceback/Error:
Code: Alles auswählen
import os
from io import BytesIO
from plyer import notification
import time
import urllib.request
import urllib
from zipfile import ZipFile
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.settings import SettingsWithSidebar
from kivy.uix.screenmanager import Screen
from kivy.clock import Clock
import json
STORAGE = "/storage/emulated/0"
APP_PATH = os.path.join(STORAGE, "TankstellenApp")
URL = "http://mscpiserver/TankstellenApp"
setting_json = json.dumps(
[
{"type":"title",
"title":"Automatische Preis-Aktualisierung"
},
{"type":"bool",
"key":"AutoUpdate",
"section":"settings"
}
]
)
g=Builder.load_string("""
#: import ListAdapter kivy.adapters.listadapter.ListAdapter
#: import ListItemButton kivy.uix.listview.ListItemButton
<ListItemButton>:
selected_color: 0,0,5,5
deselected_color: 0,0,0,0
size: (100, 175)
on_press: app.version_selected(self)
ScreenManager:
Screen
name:'main'
TabbedPanel:
tab_width: 375
pos: 0,-100
do_default_tab: False
TabbedPanelItem:
text:"OMV-Neubiberg"
BoxLayout:
padding: 120
orientation:"vertical"
pos_hint:{'top':1}
size_hint: None, None
height: 775
spacing: "100"
BoxLayout:
spacing:"300"
orientation:"horizontal"
BoxLayout:
spacing:"300"
orientation: "horizontal"
Label:
id: sorte1
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis1
height: 15
size_hint: None, None
text:"Preis: "
BoxLayout:
orientation: "horizontal"
spacing:"300"
Label:
id: sorte2
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis2
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte3
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis3
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte4
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis4
size_hint: None, None
height: 15
text: "Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte5
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis5
size_hint: None, None
height: 15
text:"Preis:"
TabbedPanelItem:
text:"DriversIn-Putzbrunn"
BoxLayout:
padding: 120
orientation:"vertical"
pos_hint:{'top':1}
size_hint: None, None
height: 775
spacing: "100"
BoxLayout:
spacing:"300"
orientation:"horizontal"
BoxLayout:
spacing:"300"
orientation: "horizontal"
Label:
id: sorte1DVP
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis1DVP
height: 15
size_hint: None, None
text:"Preis: "
BoxLayout:
orientation: "horizontal"
spacing:"300"
Label:
id: sorte2DVP
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis2DVP
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte3DVP
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis3DVP
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte4DVP
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis4DVP
size_hint: None, None
height: 15
text: "Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte5DVP
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis5DVP
size_hint: None, None
height: 15
text:"Preis:"
TabbedPanelItem:
width:300
text:"Shell-Kehferloh/Grasbrunn"
BoxLayout:
padding: 120
orientation:"vertical"
pos_hint:{'top':1}
size_hint: None, None
height: 775
spacing: "100"
BoxLayout:
spacing:"300"
orientation:"horizontal"
BoxLayout:
spacing:"300"
orientation: "horizontal"
Label:
id: sorte1KGS
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis1KGS
height: 15
size_hint: None, None
text:"Preis: "
BoxLayout:
orientation: "horizontal"
spacing:"300"
Label:
id: sorte2KGS
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis2KGS
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte3KGS
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis3KGS
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte4KGS
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis4KGS
size_hint: None, None
height: 15
text: "Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte5KGS
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis5KGS
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
orientation:"horizontal"
spacing:"300"
Label:
id: sorte6KGS
size_hint: None, None
height: 15
text:"Benzinsorte:"
Label:
id: preis6KGS
size_hint: None, None
height: 15
text:"Preis:"
BoxLayout:
padding: 350
Button:
id: refBUT
background_color: 0,0,0,0
size_hint: None, None
height: 100
width: 100
on_press: app.on_start()
on_release: app.on_start()
Image:
source: "C.png"
y: self.parent.y + self.parent.height - 100
x: self.parent.x
size: 100, 100
allow_stretch: True
ActionBar:
id: UpdInf
background_color: 5,5,5,5
pos_hint:{'bottom':1}
ActionView:
id: UpdInfView
use_separator: True
ActionPrevious:
app_icon: "Cl.png"
with_previous: False
title:"Update verfuegbar"
on_press: app.updateinfo_gone(self)
ActionButton:
icon:"Dow.png"
ActionBar:
pos_hint: {'top':1}
ActionView:
use_separator: True
ActionPrevious:
title: 'Tankstellen App'
with_previous: False
#app_icon: 'Transparent.png'
ActionButton:
#icon:'C.png'
ActionButton:
text: 'Einstellugen'
on_press: root.current='settings'
ActionButton:
text: 'Navigation'
on_press: root.current='NAV'
ActionButton:
text: 'Versionen'
on_press: root.current='Versions'
ActionGroup:
text: 'Hilfe'
ActionButton:
text: 'Anleitung'
on_press: root.current='guide'
ActionButton:
text: 'Quickstart'
on_press: root.current='QUICKSTART-Main'
ActionButton:
text: 'Support'
on_press: root.current='SUPPORT'
Screen:
name:'settings'
BoxLayout:
orientaation:"vertical"
BoxLayout:
Label:
text:" Benachrichtigung erhalten\\n bei guenstigem Preis"
Switch:
id:CheapNotSwitch
on_active: app.CheapNotSwitched(self, self.active)
on_active: app.open_settings()
# BoxLayout:
# orientation:"vertical"
# Label:
# text_size: self.size
# halign: 'center'
# valign: 'middle'
# font_size: dp(25)
# text:"Noch nicht verfuegbar\\nwarte auf Updates und versuche es dann erneut"
# Button:
# size_hint: None, None
# height: 125
# width: 750
# text:"Auf Updates pruefen"
# on_press: root.current='Versions'
ActionBar:
pos_hint:{'top':1}
ActionView:
use_seperator: True
ActionPrevious:
title:"Einstellungen"
with_previous: True
app_icon:'S.png'
on_press: root.current='main'
Screen:
name:'NAV'
BoxLayout:
orientation:"vertical"
Label:
text_size: self.size
halign: 'center'
valign: 'middle'
font_size: dp(25)
text:"Noch nicht verfuegbar\\nwarte auf Updates und versuche es dann erneut"
Button:
size_hint: None, None
height: 125
width: 750
text:"Auf Updates pruefen"
on_press: root.current='Versions'
ActionBar:
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
title:"Navigation"
with_previous: True
app_icon:'N.png'
on_press: root.current='main'
Screen:
name:"SUPPORT"
BoxLayout:
orientation:"vertical"
Label:
text_size: self.size
halign: 'center'
valign: 'middle'
font_size: dp(25)
text:"Noch nicht verfuegbar\\nwarte auf Updates und versuche es dann erneut"
Button:
size_hint: None, None
height: 125
width: 750
text:"Auf Updates pruefen"
on_press: root.current='Versions'
ActionBar:
pos_hint:{'top':1}
ActionView:
use_seperator: True
ActionPrevious:
title:"Support"
with_previous: True
app_icon:"Su.png"
on_press: root.current="main"
Screen:
name:"Versions"
BoxLayout:
orientation:"vertical"
Label:
size_hint: None, None
pos_hint:{'top':1}
text:""
BoxLayout:
orientation:"horizontal"
Button:
text:"Info"
Button:
text:"Instalieren"
ListView:
adapter: ListAdapter(data=['foo', 'bar', 'baz'], cls=ListItemButton)
size_hint: None, None
width: 725
height: 1100
ActionBar:
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
title:"Versionen"
app_icon:"V.png"
with_previous: True
on_press: root.current='main'
Screen:
name:"guide"
BoxLayout:
orientation:"vertical"
Label:
text_size: self.size
halign: 'center'
valign: 'middle'
font_size: dp(25)
text:"Noch nicht verfuegbar\\nwarte auf Updates und versuche es dann erneut"
Button:
size_hint: None, None
height: 125
width: 750
text:"Auf Updates pruefen"
on_press: root.current='Versions'
ActionBar:
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
title:"Anleitung"
app_icon:"I.png"
with_previous: True
on_press: root.current='main'
Screen:
name:'QUICKSTART-Main'
BoxLayout:
ActionBar:
background_color: 0,0,0,0
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
app_icon:"Transparent.png"
with_previous: False
ActionButton:
icon:"Cl.png"
on_press: root.current='main'
ActionBar:
background_color: 0,0,0,0
pos_hint:{'Bottom':1}
ActionView:
use_separator: True
ActionPrevious:
with_previous: False
app_icon:"NBa.png"
ActionButton:
icon:"Cg.gif"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Ne.png"
on_press: root.current='QUICKSTART-s2'
Screen:
name:'QUICKSTART-s2'
BoxLayout:
ActionBar:
background_color: 0,0,0,0
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
app_icon:"Transparent.png"
with_previous: False
ActionButton:
icon:"Cl.png"
on_press: root.current='main'
ActionBar:
background_color: 0,0,0,0
pos_hint:{'Bottom':1}
ActionView:
use_separator: True
ActionPrevious:
with_previous: False
app_icon:"Ba.png"
on_press: root.current='QUICKSTART-Main'
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cg.gif"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Ne.png"
on_press: root.current='QUICKSTART-s3'
Screen:
name:'QUICKSTART-s3'
BoxLayout:
ActionBar:
background_color: 0,0,0,0
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
app_icon:"Transparent.png"
with_previous: False
ActionButton:
icon:"Cl.png"
on_press: root.current='main'
ActionBar:
background_color: 0,0,0,0
pos_hint:{'Bottom':1}
ActionView:
use_separator: True
ActionPrevious:
with_previous: False
app_icon:"Ba.png"
on_press: root.current='QUICKSTART-s2'
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cg.gif"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Ne.png"
on_press: root.current="QUICKSTART-s4"
Screen:
name:'QUICKSTART-s4'
BoxLayout:
ActionBar:
background_color: 0,0,0,0
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
app_icon:"Transparent.png"
with_previous: False
ActionButton:
icon:"Cl.png"
on_press: root.current='main'
ActionBar:
background_color: 0,0,0,0
pos_hint:{'Bottom':1}
ActionView:
use_separator: True
ActionPrevious:
with_previous: False
app_icon:"Ba.png"
on_press: root.current='QUICKSTART-s3'
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cg.gif"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Ne.png"
on_press: root.current="QUICKSTART-s5"
Screen:
name:'QUICKSTART-s5'
BoxLayout:
ActionBar:
background_color: 0,0,0,0
pos_hint:{'top':1}
ActionView:
use_separator: True
ActionPrevious:
app_icon:"Transparent.png"
with_previous: False
ActionButton:
icon:"Cl.png"
on_press: root.current='main'
ActionBar:
background_color: 0,0,0,0
pos_hint:{'Bottom':1}
ActionView:
use_separator: True
ActionPrevious:
with_previous: False
app_icon:"Ba.png"
on_press: root.current='QUICKSTART-s4'
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cw.png"
ActionButton:
icon:"Cg.gif"
ActionButton:
icon:"NNe.png"
""")
class TankstellenApp(App):
def __init__(self):
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 = request.read().decode(request.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(url, labels):
with urllib.request.urlopen(URL + "/Versionen/latest.vers") as response:
prices = request.read().decode(request.headers.get_content_charset() or "ASCII")
for label, price in zip(label, prices.split(';')):
label.text = price
def on_start(self):
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()
Code: Alles auswählen
[INFO ] [Logger ] Record log in C:\Users\MupfSpace\.kivy\logs\kivy_19-01-28_3.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\for.py", line 781, in <module>
main()
File "c:\Users\MupfSpace\Desktop\App test1\for.py", line 778, in main
app.run()
File "C:\Python37\lib\site-packages\kivy\app.py", line 797, in run
if not self.built:
AttributeError: 'TankstellenApp' object has no attribute 'built'
- sls
- User
- Beiträge: 480
- Registriert: Mittwoch 13. Mai 2015, 23:52
- Wohnort: Country country = new Zealand();
Du rufst in TankstellenApp(App) die __init__-Methode und überschreibst damit die __init__-Methode der Superklasse. Du musst die __init__ der Superklasse erben.
Code: Alles auswählen
class TankstellenApp(App):
def __init__(self):
super().__init__()
self.blink = True
self.update = False
When we say computer, we mean the electronic computer.
Wenn man den Konstruktor (oder Initialisator technisch korrekter) ueberlaed, so wie du das tust, dann musst du auch sicherstellen, dass du den Konstruktor der Superklasse aufrufst. Und c ist ja immer noch global, voellig sinnlos auf Ebene der Klasse angegeben und angelegt. Das soll doch in __init__ passieren, und dort auch benutzt werden.
Deine build-Methode sieht kaputt aus. Nicht nur ist die Einrueckung inkonsistent, was ist denn g? Wo kommt das her? Und warum ueberlaedst du das? Weisst du, was du da tust?
Deine build-Methode sieht kaputt aus. Nicht nur ist die Einrueckung inkonsistent, was ist denn g? Wo kommt das her? Und warum ueberlaedst du das? Weisst du, was du da tust?
was g ist sieht amn am anfang des codes:
Code: Alles auswählen
g=Builder.load_string("""
...
""")
Code: Alles auswählen
super().__init__()
aber bekomme troztdem noch einen fehler:
Code: Alles auswählen
[INFO ] [Logger ] Record log in C:\Users\MupfSpace\.kivy\logs\kivy_19-01-28_10.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 783, in <module>
main()
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 780, 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 735, in on_start
self.check_version()
File "c:\Users\MupfSpace\Desktop\App test1\mainpy3v6.0.py", line 720, in check_version
version = request.read().decode(request.headers.get_content_charset() or "ASCII")
NameError: name 'request' is not defined
wenn ich das modul request importiere:
passiert genau das gleiche
Code: Alles auswählen
Import request
- sls
- User
- Beiträge: 480
- Registriert: Mittwoch 13. Mai 2015, 23:52
- Wohnort: Country country = new Zealand();
Das modul heißt requests.
EDIT:
Übersehen dass du urllib verwendest:
Du willst doch wissen, was response liefert. request alleine ist sinnlos.
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")
Zuletzt geändert von sls am Montag 28. Januar 2019, 18:39, insgesamt 1-mal geändert.
When we say computer, we mean the electronic computer.
- sls
- User
- Beiträge: 480
- Registriert: Mittwoch 13. Mai 2015, 23:52
- Wohnort: Country country = new Zealand();
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()....
prices = response.read()....
When we say computer, we mean the electronic computer.
erwas verstehe ich noch nicht daranSirius3 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
was bedeutet
Code: Alles auswählen
zip()
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
- sls
- User
- Beiträge: 480
- Registriert: Mittwoch 13. Mai 2015, 23:52
- Wohnort: Country country = new Zealand();
Das sollte wohl:
heißen.
Code: Alles auswählen
for label, price in zip(labels, prices.split(';')):
When we say computer, we mean the electronic computer.
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:
aber die App startet sich schon mal

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
- sls
- User
- Beiträge: 480
- Registriert: Mittwoch 13. Mai 2015, 23:52
- Wohnort: Country country = new Zealand();
Also, ich nehme mal an der Code schaut immer noch so aus:
Probier' mal:
Code: Alles auswählen
Clock.schedule_interval(app.on_start, 30)
Code: Alles auswählen
def on_start(self, dt)
When we say computer, we mean the electronic computer.