我想在tkinter的输入小部件中添加一些信息

2024-05-09 16:07:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在条目小部件或任何其他小部件中添加帐户代码和值,但我不知道如何做到这一点 资料如下:

{100:'现金',101:'设备',102:'用品',103:'增值',104:'预保险', 200:“应付账款”,201:“应付账款”,202:“应付利息”,203:“应付折旧”,204:“应付工资”, 300:“业主资本”,301:“业主图纸”, 400:“服务收入”,401:“租金收入”, 500:“工资和工资费用”,501:“公用事业费用”,502:“租金费用”,503:“保险费用”,504:“折旧费用”,505:“用品费用”}

因此,当用户想要插入帐户时,他可以知道他想要插入的值的帐户代码


Tags: 代码部件条目帐户费用资本资料应付账款
1条回答
网友
1楼 · 发布于 2024-05-09 16:07:41

如果只想在GUI窗口中列出代码和相应的值,可以执行以下操作

import tkinter as tk

codes = {100 : 'Cash',
        101 : 'Equipments',
        102 : 'Supplies',
        103 : 'AccRec',
        104 : 'PreInsurance',
        200 : 'AccPayable',
        201 : 'NotesPay',
        202 : 'InterestPayable',
        203 : 'AccDepreciation' ,
        204 : 'Salaries and wages payable',
        300 : 'Owner_Capital',
        301 : 'Owner Drawing',
        400 : 'Service Revenue',
        401 : 'Rent Revenue',
        500 : 'Salaries and wages Expense',
        501 : 'Utilities Expense',
        502 : 'Rent Expense',
        503 : "Insurance Expense" ,
        504 : 'Depreciation Expense',
        505 : 'Supplies expense' }

window = tk.Tk()

_row = 0 
for code, value in codes.items():
    tk.Label(window, text=str(code)+' - '+value).grid(row=_row, column=0, sticky=tk.W)
    _row += 1

window.mainloop()

cl

相关问题 更多 >