Python/PySide ImportError -
So I have recently started learning Python and Toolkit pyaside but I have a problem I could not find solution , Here is the error code:
traceback (most recent call final): file "c: \ user \ column \ workspace \ application \ main.py", in line 1, ; Module & gt; From the Ui.window import window file, "C: \ user \ column \ workspace \ application \ UI \ window.py", line 4, & lt; Module & gt; From the Ui.menubar import menu bar file "C: \ user \ column \ workspace \ application \ UI \ menubar \", line 3, in & lt; Module & gt; Ui.window import from window import Err: name 'window' can not import
and here is the code:
main.py:
< Import> PySide.QtCore import from the window.System import from Python. * From Import UI.window window from window = window () wind.Create ()
QtGui import * ui.menubar import menuBar square window: title = "callum" minWidth = 980 minHeight = 640 app = any win = any def (self): self.app = QApplication (sys.argv) auto.win = QMainWindow () self.win.setWindowTitle (self.title) self.win.setMinimumSize (self.minWidth, self.minHight) mB = MenuBar () mB.Create () self.win.show () sys.exit (self .app.exec_ ())
menubar.py:
from PySide.QtCore import * from PySide.QtGui import * to ui.window import window Class menuBar: def (self): wind = window (menu) = wind.menuBar () File Menu = menu.addMenu ("file") File menu.Adaction ("Exit", Exit)
- main.py class = "post-text" itemprop = "text" Import
ui.window
then:
- window.py import
ui.menubar
and then:
- menubar.py import
ui.window
And now we are in an infinite loop of import, window
import menu
import Window
importing with MenuBuger
... etc etc Apart from this, the course prevents the situation from being caused by an error except the dragon.
However, such other structures are how the application is structured. Specifically, creates a new example of menucut.create
method window
, adds some menu items in it, and then immediately removes the results you do instead This should be done as a logic from windows
to menu barter. Create a current instance of
, such as:
PySide.QtGui import from .QtCore import * from PySide * # removed follwing import, which does not require # ui.window import From the window class menuBar: create def (self, air): # a new example # wind = do not make window (menu) = wind.menuBar () fileMenu = menu.addMenu ("file") file menu.adayment ("exit" ", Exit)
and then window.py , do this:
self.win = QMainWindow (). .. mB = MenuBar () mB.Create (self.win)
Comments
Post a Comment