Re[PyQt] directing function output from one widget to another

klia alwaseem307ster at yahoo.com
Sun Feb 15 07:05:42 GMT 2009


hello everyone

i have a search program that query about data in DB created using sqlite.

i have build a small interface to be linked with the program in qt designer.
how can i redirect my output of the search from lineEdit to listViewitem
widget whenever i click search.
http://www.nabble.com/file/p22020178/Screenshot-MainWindow.png
Screenshot-MainWindow.png  and here's the code of my main program

import sys
import os
from search import Ui_MainWindow as UIMW
from PyQt4 import QtCore, QtGui
import urllib2 as ulib
import sqlite3
from pysqlite2 import dbapi2 as sqlite3

def globalF():
	connection = sqlite3.connect('Photos.db')
        memoryConnection = sqlite3.connect(':memory:')
        cursor = connection.cursor()
	cursor.execute('SELECT * FROM photos where Tag = "Tag"')
        print cursor.fetchall()

class MainWindow (QtGui.QMainWindow, UIMW):
	
	def __init__(self):
		QtGui.QMainWindow.__init__(self)
		self.setupUi(self)
		self.__setupConnection()
		
	def __setupConnection(self):
		self.connect(self.pushButton, QtCore.SIGNAL("clicked()"), globalF)
		
	def _pushButtonClicked(self):
		search=str(self.lineEdit.text()).strip()
		
		if search:
			try:
				self.listWidget.append(ulib.searchresult(search).read())
			except:
				pass
		else:
			pass
		
		
if __name__=="__main__":
	app=QtGui.QApplication(sys.argv)
	w=MainWindow()
	w.show()
	sys.exit(app.exec_())
-- 
View this message in context: http://www.nabble.com/Redirecting-function-output-from-one-widget-to-another-tp22020178p22020178.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list