#๐ i dont know how to run the code
61 messages ยท Page 1 of 1 (latest)
@vast sierra
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
What exactly is the problem? The code would be run the same way regardless of if you're using Tkinter.
it is like this but i think i added a window in it but i dont know how to see and open the window that i made
im always runing my code like in the pic
how are you running it?
Show your code
!code
family_name = input("whats your family name? ")
age = int(input("when did you born? "))
money = int(input("how much money do you have? "))
if money > 500000:
welth = "rich"
else:
welth = "poor"
print(name, family_name, age, welth)
import tkinter as tk
from tkinter import messagebox
app = tk.TK()
Hey @vast sierra!
Add a py after the three backticks.
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
win R
cmd
and type the path of the progect
if im not wrong, if you have an input, python wont execute any code below the input until you enter something for it
yes i know and the code is working but there is no window
and its should be an window there
What happens after you enter 4 inputs?
only print the inputs and do some math to the money
oh yes wait i will try it
Ryan's right that you're missing a call to mainloop. You need that to hand control over to Tkinter
did it work?
i forgot how to enter the path in the smd (:
cd path/to/folder
then python filename.py to run
what's first?
ah...
this is why we dont use spaces in filenames
replace the file name with first_program.py
okay wait (:
you could get it to work if you used quotations like "first program.py", but it's better if you just dont add spaces in file names
you need to do all the inputs before the tkinter code executes
im guessing you havent installed tkinter as well?
no need to install it, it's part of the python standard library
and there is something worng
right, I forgot ๐ญ
the text tells you what's wrong
its was TK and i make it Tk with smal k
but its didnt work and he still tell me the same
you might not have saved the file lol
(: i didnt think i need to save it cuz i was go off and come back and the changes stays
ohh daamnnn
thanks
and you made me learn a lot of things thanks alot
np ๐
if u want to run ur file name that has a space you can do it like first" "project.py
rather just have the whole file name inside the quotes
that can be done too
it's easier if there are several spaces in the name of the file
yea windows does that on its own when u hit some letters and tab
anyways, super important lesson, always make use you have saved your files before running anything, otherwise you are running the old version of the code since last time you saved the file
learning this the hard way makes it stick much better though ๐
yes, nowadays, linux/unix has been doing that (or escaping each space with a backslash) for decades when you tab out file names
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.