- View New Content
- OpenPandora
- General Information
-
Emulation
- Acorn Archimedes
- Acorn BBC Micro
- Amstrad CPC
- Android
- Arcade Machines
- Atari Classic Computer
- Atari ST
- Atari VCS7800
- Commodore Amiga
- Commodore 64 (and more)
- HP-48GX Calculator
- Laser Disc Arcade
- MS-DOS
- NEC PC Engine / TurboGrafx 16
- Nintendo Entertainment System
- Nintendo GameBoy / GameBoy Color
- Super Nintendo
- Nintendo GameBoy Advance
- Nintendo DS
- Sega Master System / GameGear
- Sega Genesis / MegaDrive and AddOns
- Sega Saturn
- Sharp MZ-Series
- SNK NeoGeo Pocket
- Sony MSX
- Sony PlayStation 1
- Sony PSP
- Texas Instruments TI-99
- ZX Spectrum
- Community
- Development
- Contact us
- Donate
-
More
PYQT4 Core?
Started by meandu229, Jun 14 2011 08:59 PM
10 replies to this topic
#1
ONLINE
Posted 14 June 2011 - 08:59 PM
IM trying to write a GUI app which works on my desktop but requirea pyqt4 core as it gives
ImportError: No module named PyQt4.QtCore
ImportError: No module named PyQt4.QtCore
#2
ONLINE
Posted 14 June 2011 - 09:10 PM
I did a opkg install some python modules (yup not ideal)
now I get the error above but with module named uic
edit error is wrong
ImportError:cannot import name uic
now I get the error above but with module named uic
edit error is wrong
ImportError:cannot import name uic
#3
OFFLINE
#4
ONLINE
Posted 15 June 2011 - 07:47 AM
Gotcha thank,
It now runs with the ui showing but compains about my slot
its currently like the below and runs on my pc, guess im gonna have to keep googling after work
@pyqtSlot
def click():
blah blah
It now runs with the ui showing but compains about my slot
its currently like the below and runs on my pc, guess im gonna have to keep googling after work
@pyqtSlot
def click():
blah blah
#5
ONLINE
Posted 15 June 2011 - 09:21 PM
I really really cant shift this error
NameError: name 'pyqtSlot' is not defined
I have QtCore imported
as below
NameError: name 'pyqtSlot' is not defined
I have QtCore imported
as below
from PyQt4 import uic from Another import remote from PyQt4 import QtGui from PyQt4.QtCore import * import urllib2its erroring on the below
@pyqtSlot()
def upButton(self):
rem.send('input.up', '')
#6
OFFLINE
Posted 15 June 2011 - 11:49 PM
I really really cant shift this error
NameError: name 'pyqtSlot' is not defined
its erroring on the below@pyqtSlot() def upButton(self): rem.send('input.up', '')
Well, what's @pyqtSlot? It's bugging out because it has no idea what you're trying to do with the decorator. GIMF: pyqtSlot is available as of QT 4.5. Chances are you don't have that version. Just to explain what's going on behind the scenes, your code above is pretty equivalent to:
def upButton(self)
rem.send("input.up", "")
PyQt4.QtCore.pyqtSlot(upButton)
I might've simplified away a few too many details, but that's the concept behind decorators. The decorator (a function) just gets called on the method it's wrapping.
#7
OFFLINE
Posted 16 June 2011 - 12:24 AM
Actually it is closer toJust to explain what's going on behind the scenes, your code above is pretty equivalent to:
def upButton(self) rem.send("input.up", "") PyQt4.QtCore.pyqtSlot(upButton)
I might've simplified away a few too many details, but that's the concept behind decorators. The decorator (a function) just gets called on the method it's wrapping.
def upButton(self):
rem.send("input.up", "")
upButton = PyQt4.QtCore.pyqtSlot(upButton)
A decorator is a higher order function which takes one function as an argument and returns one function (not necessarily the same one) as a result. The decoration is performed before assignment into the module namespace. def upButton(self): rem.send("input.up", "")
# is roughly equivalent to:
upButton = lambda self: rem.send("input.up", "")
Hence
@pyqtSlot
def upButton(self): rem.send("input.up", "")
# can be read as:
upButton = pyqtSlot(lambda self: rem.send("input.up", ""))
Except that that the lambda has its func_name attribute set to '<lambda>' instead of "upButton". So, perhaps this is a more accurate (though less clear) model for its semantics:
upButton = pyqtSlot(
(lambda function: (setattr(function, "func_name", "upButton"), function)[-1])(
lambda self: rem.send("input.up", "")))
#8
OFFLINE
Posted 16 June 2011 - 05:37 AM
Yeah, skipping "upButton = ..." was what I meant by oversimplification. As long as you understand that a decorator wraps your function (think Advice in the Emacs paradigm) you got it.
#9
OFFLINE
Posted 16 June 2011 - 12:23 PM
So you pulleg Angstrom bits and still worked? Against our native QT? Awesome and lucky 
I'm hoping someone or me will do a ni e Qt 4.7.x build with pyqt or pyside bindings.. Shouldn't be too bad a build (and sebt3 among others have done a nice fresh Qt build of course.)
Jeffphonesick
I'm hoping someone or me will do a ni e Qt 4.7.x build with pyqt or pyside bindings.. Shouldn't be too bad a build (and sebt3 among others have done a nice fresh Qt build of course.)
Jeffphonesick
#10
ONLINE
Posted 16 June 2011 - 01:10 PM
Cheers for all the advice Ill try it when I get home, hopefully ill have a semi useful app soon.
yes skeezix I was pulling lots from angstrom repo and all seems to work fine, (yey for booting from SD card)
yes skeezix I was pulling lots from angstrom repo and all seems to work fine, (yey for booting from SD card)
#11
ONLINE
Posted 17 June 2011 - 03:43 PM
Cheers guys a combination of a few of your ideas and I got it working, I will no doubt have more questions but about the coding + functionality of my little application once its at a bit more of a mature stage but thanks for the help
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users



