【问题标题】:A right background color of a button with tkinter?带有tkinter的按钮的正确背景颜色?
【发布时间】:2014-12-25 19:08:27
【问题描述】:

我已经用 Tkinter 在按钮中设置了背景颜色,但是当我单击按钮时,背景颜色会变为系统颜色,在我的情况下是 windows 8.1。有没有办法解决这个问题? 代码:

compute = tk.Button(rframe, text='Equals', command=comp_s, relief='flat', font=MY_FONT, background='blue', foreground='white')
compute.pack(side='left')

我正在使用 Python 3.4.2 64 位

谢谢!

【问题讨论】:

    标签: python-3.x tkinter


    【解决方案1】:

    当按住鼠标左键时,屏幕按钮会变为“活动”颜色。以下对我来说是这样的(Win7、3.4.2)。

    from tkinter import *
    r= Tk()
    b= Button(text='hello', foreground='white', background='green',
              activeforeground='red', activebackground='blue')
    b.pack()
    

    【讨论】:

      猜你喜欢
      • 2012-07-07
      • 1970-01-01
      • 2020-10-09
      • 2013-06-24
      • 1970-01-01
      • 1970-01-01
      • 2020-11-11
      • 1970-01-01
      • 2020-08-19
      相关资源
      最近更新 更多