Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
- MonkeyBean2
-
Scratcher
500+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
Can I be a helper?
Last edited by MonkeyBean2 (June 29, 2022 20:14:41)
- Joshisaurio
-
Scratcher
100+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
Please wait longer to bump your posts, about 1 dayCan I be a helper? I'm very advanced with Python.bump
- Joshisaurio
-
Scratcher
100+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
I want to be a helper! - Can I be a helper? I'm quite advanced with Python.Sure! Also about your double post please be patient it takes me a while to post because of the 60 second post wait
- ScratchTheCoder12345
-
Scratcher
500+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
Any help needed? Feel free to message me here or on my profile!
- Joshisaurio
-
Scratcher
100+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
Can I be a helper?What code editors do you use?
- mzarony0
-
Scratcher
48 posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
I have yet another question. I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad). I have figured everything out other than the downloading part. Is there a built in function to download or is there a library? Thanks!

Last edited by mzarony0 (June 29, 2022 20:31:43)
- Dinosu
-
Scratcher
82 posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
I have yet another question. I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad). I have figured everything out other than the downloading part. Is there a built in function to download or is there a library? Thanks!It depends on how you're doing things. Are you using the input() function to get the user's input in the console, and have you worked with text files before?
- mzarony0
-
Scratcher
48 posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
yes and yesI have yet another question. I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad). I have figured everything out other than the downloading part. Is there a built in function to download or is there a library? Thanks!It depends on how you're doing things. Are you using the input() function to get the user's input in the console, and have you worked with text files before?
- Dinosu
-
Scratcher
82 posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
So I suppose the question is that you've loaded the user's input into the text file and want to download that file automatically. You have a few options for accomplishing this, and this article should help you choose one.yes and yesI have yet another question. I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad). I have figured everything out other than the downloading part. Is there a built in function to download or is there a library? Thanks!It depends on how you're doing things. Are you using the input() function to get the user's input in the console, and have you worked with text files before?
Edit: the way this works also depends on the IDE. I believe the article I just referenced only works in Replit, because it is the only IDE we have listed in this topic that provides support for a web-based file created by a program. Sorry, I overlooked the question when I was answering; I'm sure there's a better way.
Last edited by Dinosu (June 29, 2022 20:49:01)
- MonkeyBean2
-
Scratcher
500+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
I have yet another question. I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad). I have figured everything out other than the downloading part. Is there a built in function to download or is there a library? Thanks!
Well, i'm not sure what you mean by ‘download’ exactly, but this is how you write/read files:
# write to file: with open("file.txt", "w") as f: f.write("I wrote something to a file!!! YAY!!!") # # # append to file (add more stuff to the end of a file): with open("file.txt", "a") as f: f.write("I appended something! :D") # # # read file: with open("file.txt", "r") as f: print(f.read())
- ScratchTheCoder12345
-
Scratcher
500+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
They mean download something to your device like download random_file.txt to your computer's hard drive.I have yet another question. I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad). I have figured everything out other than the downloading part. Is there a built in function to download or is there a library? Thanks!
Well, i'm not sure what you mean by ‘download’ exactly, but this is how you write/read files:# write to file: with open("file.txt", "w") as f: f.write("I wrote something to a file!!! YAY!!!") # # # append to file (add more stuff to the end of a file): with open("file.txt", "a") as f: f.write("I appended something! :D") # # # read file: with open("file.txt", "r") as f: print(f.read())
- Dinosu
-
Scratcher
82 posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
yes and yesI have yet another question. I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad). I have figured everything out other than the downloading part. Is there a built in function to download or is there a library? Thanks!It depends on how you're doing things. Are you using the input() function to get the user's input in the console, and have you worked with text files before?
I have never downloaded a local file using Python, but it seems unnecessary considering that the file is already created on the user's computer. In general, whether you're running a program in Pycharm, Replit, Jupyter, etc., when you create a text file in your program, it will be saved in the same directory as the script. If you're running your program on an IDE local to your computer, such as Pycharm, your file will already be on your computer, but you can do things like move it to your documents folder.
If you're running something over the Internet, such as in Replit, you can manually click download on the created file, or use the option I theorized above.
- applejuiceproduc
-
Scratcher
1000+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
Vi is one of the first and most important text editors, more info here.I use VSCode, vi and replitOk but what's vi?
- mybearworld
-
Scratcher
1000+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
Ok but what's vi?vi
- DifferentDance8
-
Scratcher
1000+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad).If you use tkinter, then it is as simple as:
tkFileDialog.asksaveasfile(mode="w", defaultextension=".txt")
- NFlex23
-
Scratcher
1000+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
New banner requested by @Joshisaurio:

Banner by NFlex23
Please use this BBCode for it and leave the credit in place:

Banner by NFlex23
Please use this BBCode for it and leave the credit in place:
[img]https://assets.scratch.mit.edu/get_image/.%2E/f831be213f6f518c4cf3801129854032.png[/img]
[small][i]Banner by [url=https://scratch.mit.edu/users/NFlex23]NFlex23[/url][/i][/small]
Last edited by NFlex23 (June 30, 2022 11:47:10)
- MonkeyBean2
-
Scratcher
500+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
I am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad).If you use tkinter, then it is as simple as:code totally not stolen from stackoverflowtkFileDialog.asksaveasfile(mode="w", defaultextension=".txt")
That brings up the file picker dialogue, opens the file you select, and can be treated similarly to
open("file path", "mode")
Example:
import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() # here, we replace open("file.txt", "w") with tkinters function with filedialog.asksaveasfile(mode="w", defaultextension=".txt") as f: f.write("blablahblah")
- MonkeyBean2
-
Scratcher
500+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
They mean download something to your device like download random_file.txt to your computer's hard drive.
Saying “download” usually means getting data from another computer.
- ScratchTheCoder12345
-
Scratcher
500+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
hahan stack overflowI am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad).If you use tkinter, then it is as simple as:code totally not stolen from stackoverflowtkFileDialog.asksaveasfile(mode="w", defaultextension=".txt")
- MagicCrayon9342
-
Scratcher
1000+ posts
PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
You can take a look at the sources of AuraPad. A Python text editor written entirely in Python. Or if you want, just fork it!hahan stack overflowI am trying to create a program that allows the user to first write down whatever they want, and then download it (kind of like a small notepad).If you use tkinter, then it is as simple as:code totally not stolen from stackoverflowtkFileDialog.asksaveasfile(mode="w", defaultextension=".txt")
Last edited by MagicCrayon9342 (June 30, 2022 15:05:33)
- Discussion Forums
- » Advanced Topics
-
» PyHelp - The official Scratch Python help forum | Ask, help, discuss, & more! | +800 posts! |
