python - 是否可以在一个循环中迭代图像,使其自动将图像放入 tkinter python 的每个按钮中?
问题描述
db = open("products.txt", "r")
file = csv.reader(db, delimiter=',')
table = [ [col[0],col[1],col[2]] for col in file]
pos_x, pos_y, cntr = 1, 1, 0
for value in table:
if cntr % 5 == 0:
print(cntr)
pos_x = pos_x + 1
#pos_x = pos_x + 114
pos_y = 0
b = Button(frame, text = (value[1] ), height = 6, width = 15, command=None, anchor=S,compound=CENTER)
b.grid(row=pos_x, column=pos_y)
pos_y = pos_y + 1
#pos_y = pos_y + 100
cntr = cntr + 1
解决方案
推荐阅读
- numpy - 在python中加速欧几里得距离
- jquery - 如何在第一次单击时选中复选框
- c# - ListBox 的 Refresh 方法不会触发 DrawItem 属性的事件处理程序
- node.js - 我正在尝试从 DynamoDB 表中获取单个属性并在回调之前将它们转换为变量
- python - 为什么会低于 0
- javascript - 无法将 javascript 代码集成到我的 html 中
- python-2.7 - pool.map 函数出错:'ValueError:`x` 必须包含至少 2 个元素'
- matplotlib - 将外部库添加到 Skulpt 时出现“路径错误”
- python - 如何将字典值转换为字典集
- c++ - 为什么 --string::end() 编译但 --string.size() 不编译?