Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33872 > unrolled thread
| Started by | bakie <sagittarus999@gmail.com> |
|---|---|
| First post | 2012-11-24 02:20 -0800 |
| Last post | 2012-11-24 03:29 -0800 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.lang.python
UI error for pycharm bakie <sagittarus999@gmail.com> - 2012-11-24 02:20 -0800
Re: UI error for pycharm Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2012-11-24 11:33 +0100
Re: UI error for pycharm bakie <sagittarus999@gmail.com> - 2012-11-24 02:57 -0800
Re: UI error for pycharm bakie <sagittarus999@gmail.com> - 2012-11-24 02:58 -0800
Re: UI error for pycharm bakie <sagittarus999@gmail.com> - 2012-11-24 03:29 -0800
| From | bakie <sagittarus999@gmail.com> |
|---|---|
| Date | 2012-11-24 02:20 -0800 |
| Subject | UI error for pycharm |
| Message-ID | <0adb87de-e60b-4371-a6ff-e27c5b85a476@googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | Vincent Vande Vyvre <vincent.vandevyvre@swing.be> |
|---|---|
| Date | 2012-11-24 11:33 +0100 |
| Message-ID | <mailman.249.1353753665.29569.python-list@python.org> |
| In reply to | #33872 |
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("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
Install PySide.
--
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>
[toc] | [prev] | [next] | [standalone]
| From | bakie <sagittarus999@gmail.com> |
|---|---|
| Date | 2012-11-24 02:57 -0800 |
| Message-ID | <99004e3a-72be-4d3e-ad5d-f8aba26f5514@googlegroups.com> |
| In reply to | #33872 |
which version can i install / http://qt-project.org/downloads
[toc] | [prev] | [next] | [standalone]
| From | bakie <sagittarus999@gmail.com> |
|---|---|
| Date | 2012-11-24 02:58 -0800 |
| Message-ID | <cb06cdbf-13e3-4863-a94b-3fe4d879d743@googlegroups.com> |
| In reply to | #33872 |
i used window 7 , 64 bits
[toc] | [prev] | [next] | [standalone]
| From | bakie <sagittarus999@gmail.com> |
|---|---|
| Date | 2012-11-24 03:29 -0800 |
| Message-ID | <cf4702b1-dc96-4d1e-9467-ca56def2d313@googlegroups.com> |
| In reply to | #33872 |
I got it , Ur anser is right . use that links http://www.lfd.uci.edu/~gohlke/pythonlibs/ ( unofficial libriares )
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web