小编Jam*_*ner的帖子

Linux中的$意味着什么?

我必须解释下面代码的含义

美元位是什么意思?

 user@Linux-003 ~ $
Run Code Online (Sandbox Code Playgroud)

linux terminal

5
推荐指数
2
解决办法
2万
查看次数

如何在tkinter中制作一个闪烁的文本框?

所以我的计算类正在使用python制作一张圣诞卡,其中一个位将会有一个带有消息的文本框,但是如何使背景从绿色和红色交替?

如果有人能够帮助那将是惊人的:)

from tkinter import *
root = Tk()
root.title("Xmas Message")

#command for the button
def test_com():
    #removing the button
    act_btn.grid_remove() 

#adding the textbox for the message
msg_box = Text(root, height = 1, width = 30)
msg_box.grid(row=0, column=0)

#adding the message
msg_box.insert(END, "Happy Xmas")

#changing the background to green
msg_box.config(background="green")


#changing the background to red
msg_box.config(background="red")

root.after(250, test_com)


#button for activating the command
act_btn = Button(root, text = "1", command = test_com)
act_btn.grid(row=0, column=0)






root.mainloop()
Run Code Online (Sandbox Code Playgroud)

python textbox tkinter python-3.x

2
推荐指数
1
解决办法
7008
查看次数

如何在 Tkinter 中更新此文本框的文本?

所以我正在用 tkinter 在 python 中制作一个秒表,我有更新时间工作的循环,但我有它所以循环清除文本框,然后用新数字更新文本框。

虽然它不起作用,但由于某种原因它只是没有清除它,它只是不断地向框中添加数字。

这是我使用的代码,如果有人能够帮我看看这个,我会非常感谢它:)

import time
from tkinter import *
root = Tk()
root.title("StopWatch")

#textbox for the screen
screen = Text(root, height = 1, width = 20, bd=10)
screen.grid(row=0, column=0)

#Active variable
global stopwatch_active
stopwatch_active = False
stop_time = 0
stop_minutes = 0


#command for starting the stopwatch
def start_com():
    stop_btn.config(state=NORMAL)
    stopwatch_active = True
    start_btn.config(state=DISABLED)
    global stop_time
    stop_time += 1
    screen.insert(END, stop_time)
    root.after(1000, start_com)




#button for starting the stopwatch
start_btn = Button(root, text = "Start", width = …
Run Code Online (Sandbox Code Playgroud)

python tkinter stopwatch python-3.x

1
推荐指数
1
解决办法
3781
查看次数

标签 统计

python ×2

python-3.x ×2

tkinter ×2

linux ×1

stopwatch ×1

terminal ×1

textbox ×1