Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > UI error for pycharm

Reply
Thread Tools

UI error for pycharm

 
 
bakie
Guest
Posts: n/a
 
      11-24-2012
when I run py script in pycharm for UI


Code:
import from PySide.QtCore import * from PySide.QtGui import * import urllib2 class Form(QDialog): def __init__(self, parent=None): super(Form, self)..__init__(parent) date = self.getdata() rates = sorted(self.rates.keys()) dateLabel = QLabel(date) self.fromComboBox = QComboBox() self.fromComboBox.addItems(rates) self.fromSpinBox = QDoubleSpinBox() self.fromSpinBox.setRange(0.01, 10000000.00) self.fromSpinBox.setValue(1.00) self.toComboBox = QComboBox() self.toComboBox.addItems(rates) self.toLabel = QLabel("1.00") grid = QGridLayout() grid.addWidget(dateLabel, 0, 0) grid.addWidget(self.fromComboBox, 1, 0) grid.addWidget(self.fromSpinBox, 1, 1) grid.addWidget(self.toComboBox, 2, 0) grid.addWidget(self.toLabel, 2, 1) self.setLayout(grid) self.connect(self.fromComboBox, SIGNAL("currentIndexChanged(int)"), self.updateUi) self.connect(self.toComboBox, SIGNAL("currentIndexChanged(int)"), self.updateUi) self.connect(self.fromSpinBox, SIGNAL("valueChanged(double)"), self.updateUi) def updateUi(self): to = self.toComboBox.currentText() from_ = self.fromComboBox.currentText() amount = (self.rates[from_] / self.rates[to]) * self.fromSpinBox.value() self.toLabel.setText("%0.2f" % amount) def getdata(self): self.rates = {} try: date = "Unknown" fh = urllib2.urlopen("http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv") for line in fh: line = line.rstrip() if not line or line.startswith(("#", "Closing")): continue fields = line.split(",") if line.startswith("Date "): date = fields[-1] else: try: value = float(fields[-1])self.rates[fields[0]] = value except ValueError: pass return "Exchange rates date: " + date except Exception, e: return "Failued to download:\n%s" % e app = QApplication(sys.argv) form = Form() form.show() app.exec_()


I had this error , how to fix them ?

Code:
C:\Python27\python.exe "C:/Users/denial/PycharmProjects/currency project/alarm.py"
Traceback (most recent call last):
File "C:/Users/denial/PycharmProjects/currency project/alarm.py", line 2,in <module>
from PySide.QtCore import *
ImportError: No module named PySide.QtCore

Process finished with exit code 1
 
Reply With Quote
 
 
 
 
Vincent Vande Vyvre
Guest
Posts: n/a
 
      11-24-2012
Le 24/11/12 11:20, bakie a écrit :
> when I run py script in pycharm for UI
>
>
> Code:
> import from PySide.QtCore import * from PySide.QtGui import * import urllib2 class Form(QDialog): def __init__(self, parent=None): super(Form,self).__init__(parent) date = self.getdata() rates = sorted(self.rates.keys()) dateLabel = QLabel(date) self.fromComboBox = QComboBox() self.fromComboBox.addItems(rates) self.fromSpinBox = QDoubleSpinBox() self.fromSpinBox.setRange(0.01, 10000000.00) self.fromSpinBox.setValue(1.00) self.toComboBox = QComboBox() self.toComboBox.addItems(rates) self.toLabel = QLabel("1.00") grid = QGridLayout() grid.addWidget(dateLabel,0, 0) grid.addWidget(self.fromComboBox, 1, 0) grid.addWidget(self.fromSpinBox, 1, 1) grid.addWidget(self.toComboBox, 2, 0) grid.addWidget(self.toLabel, 2, 1) self.setLayout(grid) self.connect(self.fromComboBox, SIGNAL("currentIndexChanged(int)"), self.updateUi) self.connect(self.toComboBox,SIGNAL("currentIndexC hanged(int)"), self.updateUi) self.connect(self.fromSpinBox, SIGNAL("valueChanged(double)"), self.updateUi) def
> updateUi
> (self): to = self.toComboBox.currentText() from_ = self.fromComboBox.currentText() amount = (self.rates[from_] / self.rates[to]) * self.fromSpinBox.value() self.toLabel.setText("%0.2f" % amount) def getdata(self): self.rates = {} try: date = "Unknown" fh = urllib2.urlopen("http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv") for line in fh:line = line.rstrip() if not line or line.startswith(("#", "Closing")):continue fields = line.split(",") if line.startswith("Date "): date =fields[-1] else: try: value = float(fields[-1]) self.rates[fields[0]] = value except ValueError: pass return "Exchange rates date: " + date except Exception, e: return "Failued to download:\n%s" % e app = QApplication(sys.argv) form = Form() form.show() app.exec_()
>
>
> I had this error , how to fix them ?
>
> Code:
> C:\Python27\python.exe "C:/Users/denial/PycharmProjects/currency project/alarm.py"
> Traceback (most recent call last):
> File "C:/Users/denial/PycharmProjects/currency project/alarm.py", line 2, in <module>
> from PySide.QtCore import *
> ImportError: No module named PySide.QtCore
>
> Process finished with exit code 1

Install PySide.

--
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>

 
Reply With Quote
 
 
 
 
bakie
Guest
Posts: n/a
 
      11-24-2012
which version can i install /

http://qt-project.org/downloads
 
Reply With Quote
 
bakie
Guest
Posts: n/a
 
      11-24-2012
i used window 7 , 64 bits
 
Reply With Quote
 
bakie
Guest
Posts: n/a
 
      11-24-2012
I got it , Ur anser is right .

use that links http://www.lfd.uci.edu/~gohlke/pythonlibs/ ( unofficial libriares )
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PyCharm messed up my PyDev Jabba Laci Python 0 12-06-2012 07:09 PM
PyCharm messed up my PyDev Jabba Laci Python 0 12-06-2012 06:30 PM
PyCharm, .idea, and source control alex23 Python 0 12-15-2011 12:45 AM
PyCharm Robert H Python 6 10-19-2010 06:12 PM
Re: PyCharm alex23 Python 1 10-15-2010 06:09 PM



Advertisments