прошу помочь. не получается вытащить значение получаемое в результате QSqlQuery. все делаю по учебникам понять не могу в чем проблема..
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui, QtSql, QtCore from database2 import Baza class Prog(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setWindowTitle('MyProgramm') self.resize(1200,700) self.view=QtGui.QTableView(self) self.view.setGeometry(0, 20, 600, 600) self.view.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel) self.view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) exit = QtGui.QAction(QtGui.QIcon('exit.png'), 'Exit', self) exit.setShortcut('Ctrl+Q') self.connect(exit, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()')) t_Name_xslt = QtGui.QAction('t_Name_xslt', self) t_Platezh = QtGui.QAction('t_Platezh', self) t_Name = QtGui.QAction('t_Name', self) self.connect(t_Name_xslt, QtCore.SIGNAL('triggered()'), self.des1) self.connect(t_Platezh, QtCore.SIGNAL('triggered()'), self.des2) self.connect(t_Name, QtCore.SIGNAL('triggered()'), self.des3) menubar = self.menuBar() file = menubar.addMenu('&File') news = menubar.addMenu('&Forms') file.addAction(exit) news.addAction(t_Name_xslt) news.addAction(t_Platezh) news.addAction(t_Name) def des3(self): query = QtSql.QSqlQuery() query.exec_("SELECT NAME FROM t_Name") while query.next(): record = query.record() id_ = str(record.value("NAME").toString()) self.label = QtGui.QLabel(id_) self.box = QtGui.QVBoxLayout() self.box.addWidget(self.label) self.setLayout(self.box) app = QtGui.QApplication(sys.argv) bd1=Baza() bd1.connection_bd() my_class=Prog() my_class.show() sys.exit(app.exec_())