#๐Ÿ”’ i dont know how to run the code

61 messages ยท Page 1 of 1 (latest)

vast sierra
#

okay i was coding on wep in google
and i want to use more things as the tk
so i went to "visual studio code" and i run the code on cmd and now i want to use the tk(tkinter) and i dont know how to run the code

barren sequoiaBOT
#

@vast sierra

Python help channel opened

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.

short laurel
vast sierra
#

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

empty trout
#

how are you running it?

barren sequoiaBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

vast sierra
# short laurel Show your 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()
barren sequoiaBOT
#

Hey @vast sierra!

Please edit your message to use a code block

Add a py after the three backticks.

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
vast sierra
empty trout
vast sierra
#

and its should be an window there

short laurel
#

What happens after you enter 4 inputs?

empty trout
#

add app.mainloop() to run it

#

there isnt a loop running the tkinter window

vast sierra
vast sierra
short laurel
#

Ryan's right that you're missing a call to mainloop. You need that to hand control over to Tkinter

empty trout
#

did it work?

vast sierra
#

i forgot how to enter the path in the smd (:

empty trout
vast sierra
empty trout
vast sierra
empty trout
#

what's first?

vast sierra
#

the name of it is first program

#

i think he is taking the first word

empty trout
#

ah...

#

this is why we dont use spaces in filenames

#

replace the file name with first_program.py

vast sierra
#

okay wait (:

empty trout
#

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

vast sierra
#

its worked but there is no window

empty trout
#

you need to do all the inputs before the tkinter code executes

#

im guessing you havent installed tkinter as well?

vast sierra
gloomy condor
vast sierra
#

and there is something worng

empty trout
empty trout
vast sierra
empty trout
#

you might not have saved the file lol

vast sierra
#

(: i didnt think i need to save it cuz i was go off and come back and the changes stays

#

ohh daamnnn

#

thanks

vast sierra
empty trout
#

np ๐Ÿ‘

candid kite
#

if u want to run ur file name that has a space you can do it like first" "project.py

gloomy condor
candid kite
#

that can be done too

gloomy condor
#

it's easier if there are several spaces in the name of the file

candid kite
#

yea windows does that on its own when u hit some letters and tab

gloomy condor
gloomy condor
barren sequoiaBOT
#
Python help channel closed for inactivity

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.