PySimpleGUI / PySimpleGUI/PySimpleGUI

[Bug] table element in pysimpleguiqt dont show integer data from database sqlite3

Open
#3,794 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Python
Stars
13.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Type of Issues (Enhancement, Error, Bug, Question)

Hi this is my first time posting here sorry if i miss something ando sorry for my bad english

1 - Table element in pysimpleguiqt dont show integer data from database sqlite3

Operating System

Win10

Python version

3.8.3

PySimpleGUI Port and Version

Ports = tkinter, Qt, WxPython, Web

PySimpleGUI Version:
4.32.1
tkinter version:
8.6.9

Your Experience Levels In Months or Years

1.0_ Python programming experience
1.5_ Programming experience overall
no_ Have used another Python GUI Framework (tkinter, Qt, etc) previously (yes/no is fine)?

import sys
if sys.version_info[0] >= 3:
    import PySimpleGUIQt as sg
else:
    import PySimpleGUI27 as sg

import sqlite3

class ver_empleados:

    base ="chinook.db"

    def conexion (self,consulta,parametros = ()):
        try:
            con_base = sqlite3.connect(self.base)
            cursor_base = con_base.cursor()
            resultado = cursor_base.execute(consulta, parametros)
            con_base.commit()
            return resultado

        except sqlite3.Error as error:
            print("Error en conectar con la base de datos", error)

    def empleados(self):
        llamada_empleados = "SELECT * FROM Employee"
        datos_empleados = self.conexion(llamada_empleados,)
        ver_empleados = datos_empleados.fetchall()
        return ver_empleados

    def nombres_columnas(self):
        con_base = sqlite3.connect(self.base)
        cursor_base = con_base.execute("SELECT * FROM Employee")
        nombres = list(map(lambda x: x[0], cursor_base.description))
        return nombres

clase = ver_empleados()
datos_empleados = clase.empleados()
nombres = clase.nombres_columnas()

vista = [[sg.Frame("Empleados",[[sg.Table(values=datos_empleados, headings= nombres)]],)]]

ventana = sg.Window("Empleados",vista)

while True:
    event,values = ventana.read()
    if event == sg.WIN_CLOSED:
        break

ventana.close()
sys.exit()

empleados

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the provided script against chinook.db, using the Employee query and sg.Table setup as the entry point. Inspect the PySimpleGUIQt table path for how fetched integer values are handled; done means integer Employee fields render in the table while the existing headings and rows remain usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
databases, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.