Python编程小技巧(一)

在使用Tkinter编写代码的时候,有时候会忘记某个组件的参数是什么或者忘记某个参数怎么拼写的,此时可以通过如下方式查询组件的参数列表,以按钮组件为例:

1 # -*- coding:utf-8 -*-
2 from tkinter import *
3 bt = Button()
4 print(bt.keys())

执行上述代码,就可以打印出按钮组件Button的参数选项有哪些,如下:

['activebackground', 'activeforeground', 'anchor', 'background', 'bd', 'bg', 'bitmap', 'borderwidth', 'command', 'compound', 'cursor', 'default', 'disabledforeground', 'fg', 'font', 'foreground', 'height', 'highlightbackground', 'highlightcolor', 'highlightthickness', 'image', 'justify', 'overrelief', 'padx', 'pady', 'relief', 'repeatdelay', 'repeatinterval', 'state', 'takefocus', 'text', 'textvariable', 'underline', 'width', 'wraplength']
上一篇:嵌入式实操----基于RT1170移植lwshell库实现简单的shell功能(九)


下一篇:Linux配置简单采集