Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [PyQt] Pyqt5: How do you make a button that adds new row with data to a Qtablewidget
#1
My goal is to create a view only table that allows you to add data to table that is then displayed.

Im having trouble with making a script that will actually add a new row to the current amount of rows. Im also having trouble trying to display the data in advance.

Think of it like a program that has a line edit that allows you input whatever into it, then afterwards have a button that displays it on a table.

Thanks in advance!
Quote
#2
It depends on how many columns a row has and in which column it should be inserted.
Quote
#3
(Dec-31-2019, 09:27 AM)Axel_Erfurt Wrote: It depends on how many columns a row has and in which column it should be inserted.

Each column has 3 rows and every column will be filled in each row.
Quote
#4
Okay first you are approaching this in the wrong manner... the data in a QTreeView or QTreeWidget should be stored within your code within a List or Dictionary and any and all manipulation you are doing to the data occurs to this in code List/Dictionary -- then whenever you want you simply update the QTreeView/QTreeWidget with your data.

Either that or you let them add a row to the QTreeView and edit its contents directly but either way the behind the scenes functionality is taking place within your List/Dictionary -- you are just implementing the Editing slightly differently is all.
Quote
#5
(Dec-31-2019, 10:19 PM)Denni Wrote: Okay first you are approaching this in the wrong manner... the data in a QTreeView or QTreeWidget should be stored within your code within a List or Dictionary and any and all manipulation you are doing to the data occurs to this in code List/Dictionary -- then whenever you want you simply update the QTreeView/QTreeWidget with your data.

Either that or you let them add a row to the QTreeView and edit its contents directly but either way the behind the scenes functionality is taking place within your List/Dictionary -- you are just implementing the Editing slightly differently is all.

I understand that but my problem is I don't how to script the data into the QTablewidget because it doesn't display at all if I do so.
Quote
#6
I have an Example on github that loads tab delimited csv into QTableWidget.

Maybe this helps you.
Quote
#7
YoshikageKira Wrote:I understand that but my problem is I don't how to script the data into the QTablewidget because it doesn't display at all if I do so.

Okay you need to clarify this -- what do you mean by "script the data into the QTableWidget" what is it that you are trying to do exactly that you are not able to do -- have you created a MUC (Minimal Usable Code) to experiment with this and if no -- then can you provide a MRE (Minimal Reproducible Example) that shows what you are doing that is not working for you. Either of these two a MUC or MRE posted here will get you a much more efficient as well as quicker answer.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [PyQt] QTableWidget stylesheet error mart79 3 183 Feb-26-2020, 04:54 PM
Last Post: Denni
  PyQt5 How do you make a functioning login and registration program? YoshikageKira 4 727 Jan-17-2020, 09:51 PM
Last Post: pavulon
  PyQt5 form not displaying my data from SQLite3 Database Linuxdesire 1 1,353 Dec-09-2019, 02:49 PM
Last Post: Denni
  [PyQt] Send data between windows Pyqt5 and Qt Designer kkonrad002 8 1,335 Sep-05-2019, 02:25 PM
Last Post: Denni
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 681 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [Tkinter] How make a button perform a function after the user inputs numbers Zephyrforce 1 487 May-22-2019, 05:43 PM
Last Post: woooee
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 535 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  [PyQt] QTableWidget cell validation littleGreenDude 1 2,148 Jan-18-2019, 07:44 PM
Last Post: littleGreenDude
  Printing QTableWidget to an DIN A4 page Mady 2 1,654 Dec-18-2018, 06:56 PM
Last Post: Axel_Erfurt
  right mouse button click with PyQt5 brecht83 4 6,196 Nov-09-2018, 02:55 PM
Last Post: brecht83

Forum Jump:


Users browsing this thread: 1 Guest(s)