Python Forum
kivy SyntaxError.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
kivy SyntaxError.
#1
I follow a tutorial test kivy like below:

from kivy.app import App

# importing builder from kivy
from kivy.lang import Builder


# this is the main class which will
# render the whole application
class uiApp(App):

	# method which will render our application
	def build(self):
		return Builder.load_string(

			BoxLayout:
			size_hint: (1, 1)
			ScrollView:

			# here we can set bar color
			bar_color: [0, 0, 255, 1]

			# here we can set bar width
			bar_width: 12

			BoxLayout:



			size: (self.parent.width, self.parent.height-1)
			id: container
			orientation: "vertical"
			size_hint_y: None

			height: self.minimum_height

			canvas.before:
			Color:

			rgba: rgba("#50C878")
			Rectangle:

			pos: self.pos
			size: self.size

			Label:
			size_hint: (1, None)
			height: 300
			markup: True
			text: "[size=78]GeeksForGeeks[/size]"
			Label:
			size_hint: (1, None)
			height: 300
			markup: True
			text: "[size=78]GeeksForGeeks[/size]"
			Label:
			size_hint: (1, None)
			height: 300
			markup: True
			text: "[size=78]GeeksForGeeks[/size]"
			Label:
			size_hint: (1, None)
			height: 300
			markup: True
			text: "[size=78]GeeksForGeeks[/size]"

		)


# running the application
uiApp().run()
Error:
File "/home/mc3/kivy_test.py", line 15 BoxLayout: ^ SyntaxError: invalid syntax
What's problem?
Reply
#2
load_string() takes a string as an argument. Wrap your config commands in quotes. Use triple quotes for a multiline string.
Reply


Forum Jump:

User Panel Messages

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