Python 按钮图像边框

标签 python macos button python-2.7 tkinter

我正在尝试删除程序中按钮附带的边框。

我尝试将 bd=0 和highlightthickness=0 添加到 Button() 但它不起作用。

有人可以建议如何做到这一点吗?

当前代码示例:

self.highscore_button_image = ImageTk.PhotoImage(file="images/buttons/highscore.png")
    highscore_button = Button(self.menu_window, bd=0, highlightthickness=0, image=self.highscore_button_image)
    highscore_button.place(x=266, y=273)

按钮:我想删除白色边框...它还带有一个没有图像的常规按钮

enter image description here

enter image description here

Python版本:2.7.1 操作系统:Mac OSX Lion

目前使用 Tkinter...

最佳答案

我不确定您是否可以去掉按钮的边框。您可以使用 Label 小部件而不是 Button 小部件,并在需要可单击时将鼠标事件绑定(bind)到它。 Label 小部件没有按钮轮廓。

关于Python 按钮图像边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18364527/

相关文章:

macos - Safari浏览器(iPhone模拟器): How to see/monitor all events being triggered?

ios - 为左右按钮设置自定义 UINavigationBar 图像

c# - 根据其他按钮可见性的按钮位置

Python SciPy n选k的可能情况

python - 错误导入 python-pushover

macos - nginx 的 "ssl"指令已弃用,使用 "listen ... ssl"

python - Mechanize 提交一个表单,创建一个需要下载的动态文件

python - 我无法使用子进程运行临时文件夹中的文件吗?

python - 为极坐标创建网格

php - 更改“添加到购物车”按钮颜色并针对 Woocommerce 中缺货的产品禁用它