473,795 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PyQt database example

Can somebody point me to a quick example on how to display the result of
an SQL query in a PyQt QListBox? I've googled in vain for this.

regards,
--
Leif Biberg Kristensen
http://solumslekt.org/
Validare necesse est
Jul 18 '05 #1
2 7960
On Mon, 22 Mar 2004 08:30:18 +0100, "Leif B. Kristensen"
<ju******@solum slekt.org> wrote:
Can somebody point me to a quick example on how to display the result of
an SQL query in a PyQt QListBox? I've googled in vain for this.


Assuming you can get the results of your SQL query into string form,
it should be just a matter of inserting those strings into your
widget.

I don't know if this will help you, but here is a snip from one of my
classes where I am processing a list of text lines and displaying
those lines in a QTextEdit widget. The fields in each line are padded
to make everything come out in nice columns.

The snag that hung me up when I first started using PyQt was not
realizing that the "QStrings" that come out of a Qt widget (a C++
thingy) have to be converted to Python strings ( with the str function
). It's OK going the other way, however. You can insert a Python
string ( p below ) into a PyQt widget.

def slotParse(self) :
self.outputText Label.setText(s elf.simComboBox .currentText())
pystring = str(self.textEd it1.text()) # Convert QString to
pystring
modlist = pystring.splitl ines()
plist = parseMods(modli st)
for p in plist:
self.textEdit2. insert(p + '\n')

-- Dave

Jul 18 '05 #2
David MacQuigg wrote:
I don't know if this will help you, but here is a snip from one of my
classes where I am processing a list of text lines and displaying
those lines in a QTextEdit widget. The fields in each line are padded
to make everything come out in nice columns.


David,
thanks for your suggestion, but I've been completely stalled in my
efforts to learn PyQt due to the arcane documentation. For now I'm
doing some progress with Tkinter, as there are so many docs, resources
and tutorials on the web that even a clod like me can make some sense
of it.

I found a great multi-column listbox in Tkinter here:

<url:http://aspn.activestat e.com/ASPN/Cookbook/Python/Recipe/52266>

regards,
--
Leif Biberg Kristensen
http://solumslekt.org/
Validare necesse est
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5720
by: mghale | last post by:
Hi, I wanted to know if there is a way in DB2 UDB/AIX v. 8.2.2 to activate/start a database in a single user mode similar to how you can start the entire instance in Admin Mode. I want to take a database offline. I use the force command but there are apps that constantly try to reconnect. I want to set the database to only allow an admin to access it to run my tasks.
2
2427
by: Karen | last post by:
As an Access novice, I have built a database that contains our company customer data, job info, and surveyor time and expense. I taught myself about tables, relationships, queries, etc., but feel that this project is becoming too much for me to maintain. There has to be a more streamlined way to achieve the same result. The database is stored on our server with 20 local users and 5 remote users that connect via Citrix. The forms and...
6
2777
by: GGerard | last post by:
Hello Does anyone know if there's a way to mirror data from a backend database to a second database? Example: When writing data to one database it would mirror the data in a second database for backup and then if anything should happen to the first database the user could switch to the second backup database.
2
1362
by: Marcel Balcarek | last post by:
Does anyone have an example of serializing an object to a database table?
2
2855
by: Sacha Vieux-Roy | last post by:
I am an Access programer. I am trying to program an invoice database in vb.net. I am looking for a vb.net database example with complete source code, like the "Northwind" example in MS Access.What I find when I search for example dbs is handy little snippets for, say, binding a datagrid to an SQL table.I'm thinking it's time I lashed out and spent the money on a book - maybe I can find one with a nice example of a complete commercial application...
8
1844
by: Maxi | last post by:
Hello, i'm sorry my bad english :( I have CR9 Webservice, how to change databadse name and User_name into Webservice method? (not Viewer Control) Tks!! -- --------------------------
9
12329
by: anders | last post by:
I am writing a plugin for a piece of software in python, and I want to start up a PyQt GUI in the plugin, without stalling the main thread while the gui is running (later i will want to pass messages between the main thread and the gui thread). I'm new to pyqt, so I'm probably doing something very silly, but for the moment I'm just trying to get the first pyqt tutorial example running in a seperate thread: ----8<--------
6
9758
jafarsalam
by: jafarsalam | last post by:
hi; I'm new to PHP and AJAX MySQL codes. I found a simple code for PHP and AJAX MySQL Database communication on : http://www.w3schools.com/php/php_ajax_database.asp I downloaded the code and uploaded to my server but it does not work . I script does not display the data from the database. Can anyone look at this and help me out.
0
938
by: lakon15 | last post by:
Dear All, I'm new in DB2 We want to migrate our database from SQL Server to DB2 I want to know is it possible in DB2 to query field from two or more database, example I have two database 1. database a consist of table users ( userid,companyid,companyname)
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10216
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7543
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.