Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14215

How to execute a test function all time?

$
0
0

I want to create a command prompt simulation in python, but I have run intoan issue. Indeed, when I type the commands in my Entry, nothing happend whereas Itshould execute the functions that I created in the code. So, I guess that the problemis that my tests functions are not running all time, but even when I run them in a while Trueloop, It still does not work. If someone could help me, I would be happy. Thanks.

So, here is the code :

from tkinter import *import timebgColor = "black"window = Tk()window.title("Cmd")window.geometry("720x480")window.configure(bg=bgColor)commandShow = Label(window, text=None, font=("Courrier", 10), bg="black", fg="lime")commandShow.place(x=4, y=30)def printCommandUser(event):    textCommand = str(entrée1.get())    commandShow.config(text=None)    commandShow.config(text=str(entrée1.get()))    return textCommanddef changeBg():    if entrée1.get() == "/bgcolor":        textChangeBg = Label(window, text="Type the color of the background below", font=("Courrier", 10), bg="black", fg="lime")        textChangeBg.place(x=4, y=50)        bgColor = str(entrée1.get())        window.config(bg=bgColor)        print(bgColor)def shutdownCmd():    if entrée1.get() == "/shutdown":        window.destroy()welcomeText = Label(window, text="Welcome in your cmd ! (Type below)", font=("Courrier", 10), bg="black", fg="lime")welcomeText.place(x=4, y=10)indicationEntrée = Label(window, text="Press Enter \nto execute", font=("Courrier", 8), bg="black", fg="lime")indicationEntrée.place(x=630, y=440)entrée1 = Entry(window, width=100, bg="lime")entrée1.place(x=4, y=450)run = Truewhile run:    changeBg()    shutdownCmd()    window.bind("<Return>", printCommandUser)    window.mainloop()

Viewing all articles
Browse latest Browse all 14215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>