tkinter显示mysql表_Python(Tkinter)如何只显示Mysql记录而不显示列表?

我是Python新手,我正在编写一个测试脚本,只显示mysql记录,几乎没有格式,我不应该使用我假设的'tree'作为开始。这是我的代码:from tkinter import *

import pymysql as mdb

from tkinter import ttk

root = Tk()

root.title("eCOMMAND")

root.minsize(800,500)

root.geometry("1200x800")

tree = ttk.Treeview(root)

# Database Call

dbi = mdb.connect("localhost",port=3306, user="user", passwd="*****", db="index_db" )

cursor = dbi.cursor()

tree["columns"] = ("one", "two", "three")

tree.column("one", width=100)

tree.column("two", width=100)

tree.column("three", width=100)

cursor.execute("""SELECT * FROM caution_elements""")

dbi.commit()

cpt = 0

tree.insert('', 'end', values=(row[0], row[1], row[2]))

cpt += 1 # increment the ID

tree.pack()

photo = PhotoImage(file="test.png")

label = Label(root,image=photo)

label.pack()

root.mainloop()

我已经包括了我的整个测试脚本。我可以显示列出的记录,但是我不想要上面的空框(描述行)或空的垂直列-我只需要单元格数据。所以如果我只调用一个记录,它将只显示那个数据框。在

我想显示数据,就像你在css(php include)中调用php一样,少调用第二个php脚本结果,但如果可能的话更直接。在

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值