Python Forum
PyQt, Open a Table when a row is selected populating it with the row values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyQt, Open a Table when a row is selected populating it with the row values
#19
   
(Dec-19-2018, 06:23 PM)rarevesselt Wrote:
(Dec-18-2018, 06:17 PM)Axel_Erfurt Wrote: You mean somethig like that?

video

Download Project

Thank so much.I can see your code so worked well.Thanks for the help.I will update with the other features.You have solved it.Thanks once again Azel_ErFurt and others.

The image I added is what I end up having.But,I need help on it.When I changed the quantity of product from 1 to another number, I want the table to update automatically.How can I do that?
My second interest is how can I make multiple users to operate the UI simultaneously.

This is function I used;
    def your_function(self):
        self.row = self.Products_table.currentRow()
        self.currentproduct = (self.Products_table.item(self.row, 0).text() )
        self.currentprice = (self.Products_table.item(self.row,1).text() )
        ordereditems = QtGui.QTableWidgetItem()
        row = self.ordereditems.currentRow()
        numRows = self.ordereditems.rowCount()
        self.ordereditems.insertRow(numRows)
        self.total = 0.0
        self.items ={}
        self.ordereditems.setItem(numRows, 0, QtGui.QTableWidgetItem(self.currentproduct))
        self.ordereditems.setItem(numRows, 1, QtGui.QTableWidgetItem(str(self.currentprice)))
        self.ordereditems.setItem(numRows, 2, QtGui.QTableWidgetItem("1"))
        for numRows in range(numRows+1):
            self.ordereditems.setItem(numRows, 2, QtGui.QTableWidgetItem(str(self.currentquantity)))
            self.currentprice =float(self.ordereditems.item(numRows,1).text() )
            amount = float(self.currentprice) * float(self.currentquantity)
            self.ordereditems.setItem(numRows, 3, QtGui.QTableWidgetItem(str(amount)))
            self.total += amount
        self.totallinedit.setText(str(self.total))
        self.items = {str(self.currentproduct):self.currentquantity}
        self.items.update({str(self.currentproduct):self.currentquantity})
Reply


Messages In This Thread
RE: PyQt, Open a Table when a row is selected populating it with the row values - by rarevesselt - Mar-30-2019, 12:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] populating dropdown from Method mikisDW 2 3,956 Apr-06-2020, 08:06 PM
Last Post: mikisDW
  Populating a Listbox from db Query DT2000 2 6,568 Feb-25-2019, 05:45 PM
Last Post: DT2000
  PyQt Selected row in Table Widget rarevesselt 3 24,016 Dec-07-2018, 07:00 PM
Last Post: rarevesselt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020