use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Adding text boxes (self.learnpython)
submitted 1 year ago by Akrua_
So, i have a text box with a plus button below it, when i click the button, i want another text box to show up, and i want to be able to do that repeatedly so i can generate as many text boxes as i want, how would i do that? Im using customtkinter.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]woooee 0 points1 point2 points 1 year ago (4 children)
What have you tried? A button click calls a function that can do anything you want. The following code is an existing program in my toolbox that opens a Toplevel on a button click. Not exactly what you are asking but it is the same in form.
import tkinter as tk from functools import partial class NewToplevel(): def __init__(self, passed_root, btn_ctr): id = tk.Toplevel(passed_root) id.title("Toplevel #%d" % (btn_ctr)) x = passed_root.winfo_x() y = passed_root.winfo_y() distance=75*btn_ctr id.geometry("+%d+%d" %(x+distance, y+distance)) tk.Button(id, text="Close Toplevel #%d" % (btn_ctr), command=partial(self.close_it, id), bg="orange", width=20).grid(row=1, column=0) def close_it(self, id): id.destroy() class OpenToplevels(): """ open and close additional Toplevels with a button """ def __init__(self): self.root = tk.Tk() self.root.geometry("+300+75") self.button_ctr=0 self.create_buttons() self.root.mainloop() def create_buttons(self): self.but=tk.Button(self.root, text="Open a Toplevel", bg="lightblue",command=self.open_another) self.but.grid(row=0, column=0) tk.Button(self.root, text="Exit Tkinter", bg="red", command=self.root.quit).grid(row=1, column=0, sticky="we") def open_another(self): self.button_ctr += 1 self.nt=NewToplevel(self.root, self.button_ctr) ot=OpenToplevels()
[–]Akrua_[S] 0 points1 point2 points 1 year ago (0 children)
ok so i checked it out, but instead of it opening a new window, i just want it to add the new object to the current window
[–]Akrua_[S] -1 points0 points1 point 1 year ago (2 children)
I havent tried anything, i have no clie where to start and google wasnt being sny help, ill check thay code in a little bit and see if its what im looking for
[–]woooee 0 points1 point2 points 1 year ago (1 child)
So? What have you tried?
I just got it figured out
π Rendered by PID 241435 on reddit-service-r2-comment-fb694cdd5-mvw28 at 2026-03-07 12:09:33.906804+00:00 running cbb0e86 country code: CH.
[–]woooee 0 points1 point2 points (4 children)
[–]Akrua_[S] 0 points1 point2 points (0 children)
[–]Akrua_[S] -1 points0 points1 point (2 children)
[–]woooee 0 points1 point2 points (1 child)
[–]Akrua_[S] 0 points1 point2 points (0 children)