Sqlite3 with tkinter

0

I have a problem wanting to get a data from the db and show it in an entry in the tkinter window, it does not show it.

from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import tkinter as tk
import sqlite3
import string

root = Tk()
root.geometry("850x600+0+0")
root.title("PTARDAPP")

def dict_factory(cursor,row):
    d = {}
    for idx, col in enumerate (cursor.description):
        d[col[0]] = row[idx]
    return d

conn = sqlite3.connect('ptardsapi.db')
conn.row_factory = dict_factory

consulta = conn.cursor()

sql = "SELECT * from poblacion WHERE id = 18"
consulta.execute(sql)
entrQmaxCar = consulta.fetchone()

entrQmaxCar["Qpromm3"]

etiqueta9 = Label(root, text = "Tiempo funcional: ", font = ("Time new roman", 30), fg = "black").place(x = 150, y = 80)
etiqueta10 = Label(root, text = "Altura: ", font = ("Time new roman", 30), fg = "black").place(x = 150, y = 130)
etiqueta11 = Label(root,text = "Qmax en m3/s: ", font = ("Time new roman",30), fg = "black").place(x =150, y = 170)
etiqueta12 = Label(root, text = "Qmin en m3/s: ", font = ("Time new roman", 30), fg = "black").place(x = 150, y = 240)

valor1 = IntVar(value = 1)
valor2 = IntVar(value = 1)
tf = Spinbox(root,from_=10, to=60, increment = 10,width= 10, textvariable = valor1).place(x = 465, y = 100)
H = Spinbox(root,from_=5, to=12, width= 10, textvariable = valor2).place(x = 270, y = 150)

entrQminCar = DoubleVar()

txtQmaxi = Entry(root, textvariable =  entrQmaxCar, width = 70).place(x = 150, y = 220)
txtQmin = Entry(root, textvariable = entrQminCar, width = 70).place(x = 150, y = 290)

root.mainloop()
    
asked by RaúlRueda 27.10.2018 в 02:22
source

0 answers