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;
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
add a comment |
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
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
add a comment |
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
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
python pyqt4 qlineedit
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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.
Thanks for responce, Its working correctly.
– sandeep pawar
Mar 30 at 5:12
add a comment |
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])
Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.
– ChrisBe
Mar 28 at 12:12
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Thanks for responce, Its working correctly.
– sandeep pawar
Mar 30 at 5:12
add a comment |
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.
Thanks for responce, Its working correctly.
– sandeep pawar
Mar 30 at 5:12
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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])
Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.
– ChrisBe
Mar 28 at 12:12
add a comment |
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])
Welcome to stackoverflow. Please elaborate how your code snipped relates and or awnsers the question.
– ChrisBe
Mar 28 at 12:12
add a comment |
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])
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])
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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