Home > other > Cython a very simple but very tricky problems
Cython a very simple but very tricky problems
Time:11-24
This piece of code in cython compile time error:
# - * - coding: utf-8 - * -
# Form implementation generated from reading the UI file 'test_cython. UI' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! The import sys, OS Sys. Path. Append ('../') The from PyQt5. QtWidgets import * The from PyQt5. QtWidgets import QPushButton The from PyQt5. QtWidgets import QApplication The from PyQt5. QtCore import QRect, QCoreApplication, QMetaObject The from test_cython. Test_cython3 import *
The class Ui_MainWindow (QMainWindow) : Def setupUi (self, the MainWindow) : MainWindow. SetObjectName (" MainWindow ") MainWindow. Resize (800, 600) Self. Centralwidget=QWidget (MainWindow) Self. Centralwidget. SetObjectName (" centralwidget ") Self. PushButton=QPushButton (self. Centralwidget) The self. The pushButton. SetGeometry (QRect (350, 210, 75, 23)) The self. The pushButton. SetObjectName (" pushButton ") MainWindow. SetCentralWidget (self. Centralwidget) The self. The menubar=QMenuBar (MainWindow) The self. The menubar. SetGeometry (QRect (0, 0, 800, 23)) The self. The menubar. SetObjectName (" menubar ") MainWindow. SetMenuBar (self. Menubar) The self. The statusbar=QStatusBar (MainWindow) The self. The statusbar. SetObjectName (" statusbar ") MainWindow. SetStatusBar (self. The statusbar)
Self. RetranslateUi (MainWindow) QMetaObject. ConnectSlotsByName (MainWindow) The self. The pushButton. SetText (' test ') Def TMP () : The eval (' QDialog (). The exec () ') The self. The pushButton. Clicked. Connect (TMP)
Def retranslateUi (self, the MainWindow) : _translate=QCoreApplication. Translate MainWindow. SetWindowTitle (_translate (" MainWindow ", "MainWindow")) The self. The pushButton. SetText (_translate (" MainWindow ", "pushButton"))
Then I found that as long as the code inside a ". The exec "cython cannot be compiled through, it's really a god, The exec () to the show () compiled through, to eval (' QDialog (), exec () ') compilation can also pass,,
So in the exec cython there is a special string? Why there is no way to compile?? Great god give advice or comments, please ~!!
CodePudding user response:
The exec's built-in functions: https://docs.python.org/3/library/functions.html#exec