D
D
dgkotkovsky2015-04-23 22:43:14
Python
dgkotkovsky, 2015-04-23 22:43:14

Why is an error thrown in pyQt5?

I installed Python 3.4.3 and pyQT 5. When I try to create a simple window with the code below, IDLE gives an Invalid Syntax error and, accordingly, the window is not created. I checked the syntax, everything seems to be correct. What could be the reason?
{
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import QApplication, QWidget
if __name__ == '__main__':
app = QApplication(sys.argv)
w = QWidget ()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
}
337f1cc79f4f479090d3b4504a15a725.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
bobrovskyserg, 2015-04-23
@bobrovskyserg

Because "invalid syntax", you have an invalid syntax.
Since you couldn't paste the formatted code into the question, it's difficult to point out exactly where the error is.
Fix it.
Your _formatted_ code works for me (Ubuntu).

V
Vladimir Martyanov, 2015-04-23
@vilgeforce

Do you also have curly braces in your script?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question