Hi All,
I've just started using Kivy. I am using Python 3.7 and Kivy 1.10.1 on a windows 10 machine. I was just following one of the available tutorials on Youtube. Then I decided to tweak the script and am getting a really weird error...
the problem is, I've created two screens and a button on each screen to switch the screens.... Then I decided to add another button to one of the screens to do something else... But when I did that and ran the code, I received the error in the subject line. I thought it was Pycharm or Python so I googled the issue and tried to change all sort of things to no avail... I ran the program from the console and same thing happened so it isn't Pycharm...
Finally I started one by one to remove Kivy code lines and as soon as I removed the text property for the second button, the program started to work and the problem went away... However, as soon as I add the property back, I get the same error!
Below is the py and the Kivy codes:
Py:
import kivy
from kivy.app import App
kivy.require('1.10.1') # replace with your current kivy version !
#from kivy.uix.floatlayout import FloatLayout
#from kivy.uix.label import Label
#from kivy.uix.widget import Widget
#from kivy.graphics import Line
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivy.uix.widget import Widget
from kivy.graphics import Line
class Painter(Widget):
def on_touch_down(self, touch):
with self.canvas:
touch.ud["Line"]= Line(points=(touch.x,touch.y))
def on_touch_move(self, touch):
touch.ud["Line"].points +=(touch.x,touch.y)
class MainScreen(Screen):
pass
class AnotherScreen(Screen):
pass
class ScreenManagement(ScreenManager):
pass
presentation = Builder.load_file("main.kv")
class MainApp(App):
def build(self):
return presentation
if __name__ == '__main__':
MainApp().run()
main.kivy
#: import FadeTransition kivy.uix.screenmanager.FadeTransition
ScreenManagement:
transition: FadeTransition()
MainScreen:
AnotherScreen:
<Button>:
font_size:40
color: 0,0,1,1
size_hint: 0.3, 0.2
<MainScreen>:
name: "Main"
Button:
on_release: app.root.current = "Other"
text: "Next Screen"
pos_hint:{"right":1, 'top':1}
<AnotherScreen>:
name: "Other"
FloatLayout:
Painter
Button:
on_release: app.root.current = "Main"
pos_hint:{"right":1, 'top':1}
text: "Go Back"
Button:
pos_hint:{"right":1, 'top':0.5}
on_release: app.root.current = "Main"
text: "Return"
So, if you remove either of the text properties in AnotherScreen, the program works!
Any help is appreciated...
Thanks