-1

I'm using a library on python called kivy. I have the main code file "ngen.py" and the other file used for ui "ngen.kv". When I use boxlayout in ngen.py I get an error message even though they are in the same dir.

[Running] python -u "e:\pyapp\ngen.py"
  File "e:\pyapp\ngen.py", line 12
    returtn boxlayout()
            ^^^^^^^^^
SyntaxError: invalid syntax

The code was supposed to work because i defined boxlayout here:

#:kivy 1.9.0
<BoxLayout:>
    orientation: vertic

al

and here:

import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout

kivy.require('1.9.0')

class Ngen(App):
    
    def build(self):
        return BoxLayout()

Ngen = Ngen()
gen.run() 
quamrana
  • 37,849
  • 12
  • 53
  • 71
rinobu45
  • 1
  • 2
  • 2
    Please update your question with the correct code/error. The error you show does not align with the code you provided. Did you spell `return` as `returtn`? – quamrana Sep 02 '23 at 20:38
  • i actually spelled it right but its displayed "returtn" in terminal is there somthing i can do to update the file from terminal? – rinobu45 Sep 02 '23 at 20:41
  • 3
    Usually the error traceback is accurate, so I tend towards believing that the error is correct and you have `returtn boxlayout()` in `ngen.py`. You need to edit that file to be `return BoxLayout()` as you show in the code snippet. – quamrana Sep 02 '23 at 20:47
  • i'v checked the code again and i made sure to edit all the mistakes now im getting this error : `kivy.lang.parser.ParserException: Parser: File "e:\pyapp\ngen.kv", line 2: ... 1:#:kivy 1.9.0 >> 2: 3: orientation: vertical 4: Label: ... Invalid data after declaration` – rinobu45 Sep 02 '23 at 20:54
  • 2
    If it was a misspelling of "return", then this question is answered. A problem with the kv file would warrant a new question focused on that. But "orientation: vertic" may be another misspelling. – tdelaney Sep 02 '23 at 20:58
  • @tdelaney so i have to make another post? – rinobu45 Sep 02 '23 at 21:00
  • Yes, a new post titled and focused on the new problem is best. People who skipped this question because of the syntax error may find it interesting. And future web searchers have a more clean thing to find and read. – tdelaney Sep 02 '23 at 21:19

0 Answers0