How to display values from Database into QlineEdit pyqt4 pythonHow do I copy a file in Python?How can I safely create a nested directory?How do I connect to a MySQL Database in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I sort a dictionary by value?How do I get the number of elements in a list?How do I concatenate two lists in Python?How to access environment variable values?How to remove a key from a Python dictionary?

Why does Japan use the same type of AC power outlet as the US?

Human with super efficient metabolism

Locked Room Murder!! How and who?

Chunk + Enumerate a list of digits

Transition to "Starvation Mode" in Survival Situations

How far did Gandalf and the Balrog drop from the bridge in Moria?

Telephone number in spoken words

(A room / an office) where an artist works

Are there examples in Tanach of 3 or more parties having an ongoing conversation?

Why is there a large performance impact when looping over an array over 240 elements?

Go to last file in vim

A trip to the library

Help, I cannot decide when to start the story

Finding the shaded region

Why aren’t there water shutoff valves for each room?

Boss wants me to ignore a software API license

What should I do if actually I found a serious flaw in someone's PhD thesis and an article derived from that PhD thesis?

How can I find an old paper when the usual methods fail?

Would the USA be eligible to join the European Union?

Good textbook for queueing theory and performance modeling

When was "Fredo" an insult to Italian-Americans?

Bringing Power Supplies on Plane?

What are the advantages of this gold finger shape?

Doesn't the speed of light limit imply the same electron can be annihilated twice?



How to display values from Database into QlineEdit pyqt4 python


How do I copy a file in Python?How can I safely create a nested directory?How do I connect to a MySQL Database in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I sort a dictionary by value?How do I get the number of elements in a list?How do I concatenate two lists in Python?How to access environment variable values?How to remove a key from a Python dictionary?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















myresult = ('sandeep pawar','1234','haveri','581110','karnatak')
I want display each of these values into separate QlineEdit.



 myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
for i in myresult:
value = ' '.join(map(str,x))
a,b,c,d,e = value.split(" ")
self.lineEdit.setText(a)
self.lineEdit_2.setText(b)
self.lineEdit_3.setText(c)
self.lineEdit_4.setText(d)
self.lineEdit_5.setText(e)


I have tried with this method but i get this following error
a,b,c,d,e = value.split(" ") ValueError too many values to unpack.
Please guide me how to display values into lineEdit without using split() function.










share|improve this question


























  • Do you want each element in the list inside of a lineEdit? How many total line edits do you create from the get go?

    – Zack Tarr
    Mar 27 at 13:06











  • @ZackTarr thanks for responce ,5 lineEdits to create for display values.

    – sandeep pawar
    Mar 28 at 3:09

















0















myresult = ('sandeep pawar','1234','haveri','581110','karnatak')
I want display each of these values into separate QlineEdit.



 myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
for i in myresult:
value = ' '.join(map(str,x))
a,b,c,d,e = value.split(" ")
self.lineEdit.setText(a)
self.lineEdit_2.setText(b)
self.lineEdit_3.setText(c)
self.lineEdit_4.setText(d)
self.lineEdit_5.setText(e)


I have tried with this method but i get this following error
a,b,c,d,e = value.split(" ") ValueError too many values to unpack.
Please guide me how to display values into lineEdit without using split() function.










share|improve this question


























  • Do you want each element in the list inside of a lineEdit? How many total line edits do you create from the get go?

    – Zack Tarr
    Mar 27 at 13:06











  • @ZackTarr thanks for responce ,5 lineEdits to create for display values.

    – sandeep pawar
    Mar 28 at 3:09













0












0








0








myresult = ('sandeep pawar','1234','haveri','581110','karnatak')
I want display each of these values into separate QlineEdit.



 myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
for i in myresult:
value = ' '.join(map(str,x))
a,b,c,d,e = value.split(" ")
self.lineEdit.setText(a)
self.lineEdit_2.setText(b)
self.lineEdit_3.setText(c)
self.lineEdit_4.setText(d)
self.lineEdit_5.setText(e)


I have tried with this method but i get this following error
a,b,c,d,e = value.split(" ") ValueError too many values to unpack.
Please guide me how to display values into lineEdit without using split() function.










share|improve this question
















myresult = ('sandeep pawar','1234','haveri','581110','karnatak')
I want display each of these values into separate QlineEdit.



 myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
for i in myresult:
value = ' '.join(map(str,x))
a,b,c,d,e = value.split(" ")
self.lineEdit.setText(a)
self.lineEdit_2.setText(b)
self.lineEdit_3.setText(c)
self.lineEdit_4.setText(d)
self.lineEdit_5.setText(e)


I have tried with this method but i get this following error
a,b,c,d,e = value.split(" ") ValueError too many values to unpack.
Please guide me how to display values into lineEdit without using split() function.







python pyqt4 qlineedit






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 11:05







sandeep pawar

















asked Mar 27 at 10:58









sandeep pawarsandeep pawar

198 bronze badges




198 bronze badges















  • Do you want each element in the list inside of a lineEdit? How many total line edits do you create from the get go?

    – Zack Tarr
    Mar 27 at 13:06











  • @ZackTarr thanks for responce ,5 lineEdits to create for display values.

    – sandeep pawar
    Mar 28 at 3:09

















  • Do you want each element in the list inside of a lineEdit? How many total line edits do you create from the get go?

    – Zack Tarr
    Mar 27 at 13:06











  • @ZackTarr thanks for responce ,5 lineEdits to create for display values.

    – sandeep pawar
    Mar 28 at 3:09
















Do you want each element in the list inside of a lineEdit? How many total line edits do you create from the get go?

– Zack Tarr
Mar 27 at 13:06





Do you want each element in the list inside of a lineEdit? How many total line edits do you create from the get go?

– Zack Tarr
Mar 27 at 13:06













@ZackTarr thanks for responce ,5 lineEdits to create for display values.

– sandeep pawar
Mar 28 at 3:09





@ZackTarr thanks for responce ,5 lineEdits to create for display values.

– sandeep pawar
Mar 28 at 3:09












2 Answers
2






active

oldest

votes


















0














For a lineEdit you can just reference each element in the list, this of course assumes you always have 5 elements in your list. Which is okay but likely could be done more dynamic (see below).



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
self.lineEdit.setText(myresult[0])
self.lineEdit_2.setText(myresult[1])
self.lineEdit_3.setText(myresult[2])
self.lineEdit_4.setText(myresult[3])
self.lineEdit_5.setText(myresult[4])


The above code would work and get you a line edit for each element in your list. But if that list were to grow, you would need to add a new lineEdit to the GUI and then populate it with myresult[5]. I would rather do something like my example below.



This is for PyQt5 since I only have it installed on my PC. But why not use something more dynamic than lineedits? Such as a QlistWidget with editable items.



from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtWidgets import *

import sys



if __name__ == '__main__':
app = QApplication(sys.argv)
listWidget = QListWidget()
listWidget.show()
myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
listWidget.addItems(myresult)
for index in range(listWidget.count()):
item = listWidget.item(index)
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
sys.exit(app.exec_())


You can then bind the itemChanged event which will let you know when one of the items in the list has changed. So you can then go in and update your list after the edits are made. I hope this helps, please let me know if you have questions or need a push in the right direction.






share|improve this answer

























  • Thanks for responce, Its working correctly.

    – sandeep pawar
    Mar 30 at 5:12



















-1














This is my opinion:



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
line_edit = [self.lineEdit,self.lineEdit_2,self.lineEdit_3,self.lineEdit_4,self.lineEdit_5]
for i in range(len(line_edit)):
line_edit[i].setText(myresult[i])





share|improve this answer



























  • Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.

    – ChrisBe
    Mar 28 at 12:12













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375551%2fhow-to-display-values-from-database-into-qlineedit-pyqt4-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














For a lineEdit you can just reference each element in the list, this of course assumes you always have 5 elements in your list. Which is okay but likely could be done more dynamic (see below).



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
self.lineEdit.setText(myresult[0])
self.lineEdit_2.setText(myresult[1])
self.lineEdit_3.setText(myresult[2])
self.lineEdit_4.setText(myresult[3])
self.lineEdit_5.setText(myresult[4])


The above code would work and get you a line edit for each element in your list. But if that list were to grow, you would need to add a new lineEdit to the GUI and then populate it with myresult[5]. I would rather do something like my example below.



This is for PyQt5 since I only have it installed on my PC. But why not use something more dynamic than lineedits? Such as a QlistWidget with editable items.



from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtWidgets import *

import sys



if __name__ == '__main__':
app = QApplication(sys.argv)
listWidget = QListWidget()
listWidget.show()
myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
listWidget.addItems(myresult)
for index in range(listWidget.count()):
item = listWidget.item(index)
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
sys.exit(app.exec_())


You can then bind the itemChanged event which will let you know when one of the items in the list has changed. So you can then go in and update your list after the edits are made. I hope this helps, please let me know if you have questions or need a push in the right direction.






share|improve this answer

























  • Thanks for responce, Its working correctly.

    – sandeep pawar
    Mar 30 at 5:12
















0














For a lineEdit you can just reference each element in the list, this of course assumes you always have 5 elements in your list. Which is okay but likely could be done more dynamic (see below).



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
self.lineEdit.setText(myresult[0])
self.lineEdit_2.setText(myresult[1])
self.lineEdit_3.setText(myresult[2])
self.lineEdit_4.setText(myresult[3])
self.lineEdit_5.setText(myresult[4])


The above code would work and get you a line edit for each element in your list. But if that list were to grow, you would need to add a new lineEdit to the GUI and then populate it with myresult[5]. I would rather do something like my example below.



This is for PyQt5 since I only have it installed on my PC. But why not use something more dynamic than lineedits? Such as a QlistWidget with editable items.



from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtWidgets import *

import sys



if __name__ == '__main__':
app = QApplication(sys.argv)
listWidget = QListWidget()
listWidget.show()
myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
listWidget.addItems(myresult)
for index in range(listWidget.count()):
item = listWidget.item(index)
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
sys.exit(app.exec_())


You can then bind the itemChanged event which will let you know when one of the items in the list has changed. So you can then go in and update your list after the edits are made. I hope this helps, please let me know if you have questions or need a push in the right direction.






share|improve this answer

























  • Thanks for responce, Its working correctly.

    – sandeep pawar
    Mar 30 at 5:12














0












0








0







For a lineEdit you can just reference each element in the list, this of course assumes you always have 5 elements in your list. Which is okay but likely could be done more dynamic (see below).



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
self.lineEdit.setText(myresult[0])
self.lineEdit_2.setText(myresult[1])
self.lineEdit_3.setText(myresult[2])
self.lineEdit_4.setText(myresult[3])
self.lineEdit_5.setText(myresult[4])


The above code would work and get you a line edit for each element in your list. But if that list were to grow, you would need to add a new lineEdit to the GUI and then populate it with myresult[5]. I would rather do something like my example below.



This is for PyQt5 since I only have it installed on my PC. But why not use something more dynamic than lineedits? Such as a QlistWidget with editable items.



from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtWidgets import *

import sys



if __name__ == '__main__':
app = QApplication(sys.argv)
listWidget = QListWidget()
listWidget.show()
myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
listWidget.addItems(myresult)
for index in range(listWidget.count()):
item = listWidget.item(index)
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
sys.exit(app.exec_())


You can then bind the itemChanged event which will let you know when one of the items in the list has changed. So you can then go in and update your list after the edits are made. I hope this helps, please let me know if you have questions or need a push in the right direction.






share|improve this answer













For a lineEdit you can just reference each element in the list, this of course assumes you always have 5 elements in your list. Which is okay but likely could be done more dynamic (see below).



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
self.lineEdit.setText(myresult[0])
self.lineEdit_2.setText(myresult[1])
self.lineEdit_3.setText(myresult[2])
self.lineEdit_4.setText(myresult[3])
self.lineEdit_5.setText(myresult[4])


The above code would work and get you a line edit for each element in your list. But if that list were to grow, you would need to add a new lineEdit to the GUI and then populate it with myresult[5]. I would rather do something like my example below.



This is for PyQt5 since I only have it installed on my PC. But why not use something more dynamic than lineedits? Such as a QlistWidget with editable items.



from PyQt5 import QtGui, QtCore, QtWidgets
from PyQt5.QtWidgets import *

import sys



if __name__ == '__main__':
app = QApplication(sys.argv)
listWidget = QListWidget()
listWidget.show()
myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
listWidget.addItems(myresult)
for index in range(listWidget.count()):
item = listWidget.item(index)
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
sys.exit(app.exec_())


You can then bind the itemChanged event which will let you know when one of the items in the list has changed. So you can then go in and update your list after the edits are made. I hope this helps, please let me know if you have questions or need a push in the right direction.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 15:05









Zack TarrZack Tarr

7347 silver badges23 bronze badges




7347 silver badges23 bronze badges















  • Thanks for responce, Its working correctly.

    – sandeep pawar
    Mar 30 at 5:12


















  • Thanks for responce, Its working correctly.

    – sandeep pawar
    Mar 30 at 5:12

















Thanks for responce, Its working correctly.

– sandeep pawar
Mar 30 at 5:12






Thanks for responce, Its working correctly.

– sandeep pawar
Mar 30 at 5:12














-1














This is my opinion:



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
line_edit = [self.lineEdit,self.lineEdit_2,self.lineEdit_3,self.lineEdit_4,self.lineEdit_5]
for i in range(len(line_edit)):
line_edit[i].setText(myresult[i])





share|improve this answer



























  • Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.

    – ChrisBe
    Mar 28 at 12:12















-1














This is my opinion:



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
line_edit = [self.lineEdit,self.lineEdit_2,self.lineEdit_3,self.lineEdit_4,self.lineEdit_5]
for i in range(len(line_edit)):
line_edit[i].setText(myresult[i])





share|improve this answer



























  • Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.

    – ChrisBe
    Mar 28 at 12:12













-1












-1








-1







This is my opinion:



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
line_edit = [self.lineEdit,self.lineEdit_2,self.lineEdit_3,self.lineEdit_4,self.lineEdit_5]
for i in range(len(line_edit)):
line_edit[i].setText(myresult[i])





share|improve this answer















This is my opinion:



myresult = ['sandeep pawar','1234','haveri','581110','karnatak']
line_edit = [self.lineEdit,self.lineEdit_2,self.lineEdit_3,self.lineEdit_4,self.lineEdit_5]
for i in range(len(line_edit)):
line_edit[i].setText(myresult[i])






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 28 at 11:46

























answered Mar 28 at 11:41









Duc NguyenDuc Nguyen

214 bronze badges




214 bronze badges















  • Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.

    – ChrisBe
    Mar 28 at 12:12

















  • Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.

    – ChrisBe
    Mar 28 at 12:12
















Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.

– ChrisBe
Mar 28 at 12:12





Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.

– ChrisBe
Mar 28 at 12:12

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55375551%2fhow-to-display-values-from-database-into-qlineedit-pyqt4-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현