Python Forum
Error when running kivy on python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error when running kivy on python
#9
(Jun-16-2023, 09:54 PM)deanhystad Wrote: More indentation errors.

In Python, indenting serves the same purpose as {} in C. It creates blocks of code. If your code was written using {} for blocking, it would look like this:
from kivy.config import Config
Config.set('kivy','keyboard_mode','systemanddock')
 
from kivymd.app import MDApp
from kivy_garden.mapview import MapView
  
  
class MyApp(MDApp):
{
     def build(self):
     {
              mapview = MapView(zoom=10, Lat=36, Lon=-115)
              return mapview
              if __name__ == '__main__':
              {
                 MyApp().run()
              }
     }
}
Maybe this makes it easier to see that your code does not make any MyApp objects. The only code that makes a MyApp object is deeply embedded in the build method of the MyApp class.

Also, your indenting is all over the place. Convention is every indent level is 4 spaces deeper than the previous level.

Maybe you should work through some kivy totorials. You cannot have success if you don't understand your tools.

Thanks for input. You are right. I just thought I should try an example from a youtube video before I dived into more suitable beginner levels. Was not even aware of the indenting. I will start with Python then Kivy and hopefully end up handling maps, Thanks for help and see You later. Regards
Reply


Messages In This Thread
Error when running kivy on python - by janeik - Jun-16-2023, 01:21 PM
RE: Error when running kivy on python - by janeik - Jun-16-2023, 04:20 PM
RE: Error when running kivy on python - by janeik - Jun-16-2023, 07:05 PM
RE: Error when running kivy on python - by janeik - Jun-16-2023, 07:12 PM
RE: Error when running kivy on python - by janeik - Jun-16-2023, 08:55 PM
RE: Error when running kivy on python - by janeik - Jun-16-2023, 10:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error "cannot identify image file" part way through running hatflyer 0 733 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Getting error when running "MINUS" between 2 databases marlonbown 4 1,314 Nov-10-2022, 05:49 AM
Last Post: deanhystad
  Error while running code on VSC maiya 4 3,862 Jul-01-2022, 02:51 PM
Last Post: maiya
  Pandas - error when running Pycharm, but works on cmd line zxcv101 1 1,396 Jun-18-2022, 01:09 PM
Last Post: snippsat
  Error when running a matplot lib example aurelius_nero 3 7,039 Apr-24-2022, 01:24 PM
Last Post: Axel_Erfurt
  Keep getting Session management error when running imshow in pycharm pace 0 2,136 Mar-25-2021, 10:06 AM
Last Post: pace
  Error when running script on startup in Linux NoahTheNerd 0 1,995 Mar-07-2021, 04:54 PM
Last Post: NoahTheNerd
  Error when running mktorrent subprocess command pythonnewbie138 4 3,930 Sep-16-2020, 01:55 AM
Last Post: pythonnewbie138
  error while running in debug mode ModuleNotFoundError avipy123 0 2,664 Jul-14-2020, 02:05 PM
Last Post: avipy123
  Generate RPM package from a Python + Kivy application for an "offline" installation pruvosim 2 2,264 Jun-04-2020, 12:16 PM
Last Post: pruvosim

Forum Jump:

User Panel Messages

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