Posts by Henrique • 443 points
14 posts
-
3
votes1
answer867
viewsQ: Real-time window update problem
Hello. I am creating a program that allows the user to know which note is singing and its frequency, in real time. However, during the window update, the program stops working and only updates after…
-
1
votes1
answer5597
viewsQ: How to remove a line from a text file
Hello. I am creating a program that opens, stores or deletes links. However, although I can remove the selected item from the link list I cannot delete the file line that corresponds to the selected…
-
0
votes1
answer2285
viewsQ: Text position in Tkinter
Hello. I am working with Tkinter and I am at an impasse. I have nine buttons and each one prints a number. How can I make it so that after I press a button, no matter what button I press, a number…
-
7
votes1
answer3720
viewsQ: The.Leep() team with if/Else statements
Hi. I’m at an impasse. My goal is that if the user presses enter or waits 2 seconds it starts "Powerbit", but in an if/Else statement and I don’t know how to do it. Example: #(...) elif machine ==…
-
2
votes2
answers1172
viewsA: In Python, is there any rule or advantage regarding the use of 'Self'?
Hello. Both examples are correct but it is more common to use the self of example 2. Example of self use: class Animal(object): is_alive = True def __init__(self, name, age): self.name = name…
-
1
votes1
answer303
viewsQ: if/Else statements and time.Leep()
I have a question. It is possible to put the time.sleep() in a statement if/else? Example: import time if time.sleep(2): print "hello" else: #alguma coisa I searched the internet but found no…
-
0
votes1
answer388
viewsQ: User Choices in Tkinter
Hello. I am trying to create a program of graphical interface using Tkinter(I learned a little while ago) and I wanted the user, when writing in the text input box and pressing the button he printed…
-
3
votes1
answer122
viewsQ: How can I call functions that are after the same function?
I have sometimes managed to call functions that are further ahead in the program. However, it takes me hours to find a way to do so. What is the easiest way? Ex: def paintball(): print "Olá" adeus()…
-
1
votes1
answer89
viewsQ: Number inside a file can be the number inside the.Leep team?
Is it possible that a number within a file can be the number of seconds of the.Sleep() team? Example: time.sleep(temp) #código de leitura e salvamento de dados incluído Complete code:…
-
5
votes3
answers34998
viewsQ: Timer in Python
I’m trying to make a timer that, after 10 seconds, prints a string. I tried to use the time.sleep() and it didn’t work. Example: def tempo(): #passados 10 segundos print "olá"…
-
2
votes1
answer840
viewsQ: How to edit text
I’m trying to create an option where you can edit the initialization text, but since I already have some extensive lines of code I’m having a hard time finding a way to do it. How to do it (in a…
-
2
votes1
answer828
viewsQ: Global variable is not defined
I have been investigating for hours why this mistake. I have used the global and it didn’t work and other programs I created worked. Code that gives error: def editor(): texto = raw_input("digite o…
-
2
votes1
answer460
viewsQ: How to save user changes
I’ve been searching how to save user changes (with raw_input) in Python and I did not find something that clarified me. What is the best way to do it (even after closing the program)? Example: def…
-
2
votes1
answer955
viewsQ: I’m having trouble calling a python function
Hi. Here’s my problem: def arranque(): machine = raw_input("Bem vindo à màquina virtual(VM). Prima ENTER para iniciar o SO ou prima B para entrar no menu da BIOS.") if machine == "B".upper(): print…