tkinter-canvas

Can't scroll to things added to canvas by a button

Can't scroll to things added to canvas by a button Question: I’m finishing building an app managing a JSON and while everything is scrolling when it’s added before the mainloop starts, if I add it by a button, I can’t scroll to the newly added things (I add them by canvas.create_window(0, getfirstfreeposition(), window=thing)). I have …

Total answers: 1

How do I make a canvas and a photo the same size on Tkinter?

How do I make a canvas and a photo the same size on Tkinter? Question: I’m making a photo watermark programme using Python and Tkinter. Basically it allows the user to upload a photo and create a text watermark to put over the photo. I’m working on a function so that the user can move …

Total answers: 1

Tkinter scrollbar not updating to cover expanded canvas

Tkinter scrollbar not updating to cover expanded canvas Question: I’m having a scrollbar issue with a Tkinter GUI that I’m creating. The GUI contains a class Gen_Box that reproduces a given widget vertically downwards as many times as the widgets add_btn is called. Obviously, this runs off the window frame pretty quickly. I’ve tried adding …

Total answers: 2

Why is image not showing up

Why is image not showing up Question: Tried to display an image on a canvas but it won’t show up import tkinter class ROOT(): def __init__(self,root): root.geometry("500×500") self.canvas=tkinter.Canvas(root,width=500,height=500,bg="white") self.canvas.pack() self.photoimage=tkinter.PhotoImage(file="Untitled.png")#test image self.image=self.canvas.create_image((0,0),image=self.photoimage,anchor="nw") def main(): root=tkinter.Tk() ROOT(root) root.mainloop() if __name__=="__main__":main() I am using python 3.10.4 and have no clue why it isn’t working, can somebody explain …

Total answers: 1

How would I make this whole program repeat after the person enters an answer? (tkinter)

How would I make this whole program repeat after the person enters an answer? (tkinter) Question: So I’m making this subitizing trainer. It trains you to know how many of something there are without physically counting them. The program creates a window and then generates a random number of circles. Then you enter how many …

Total answers: 3

Python Tkinter: Unbinding Mouse Scroll Wheel on ComboBox

Python Tkinter: Unbinding Mouse Scroll Wheel on ComboBox Question: I have a combobox within a scrollable canvas frame- when I open the combobox and attempt to scroll through the options, the combobox and the entire window both scroll together. It would be nice to pause canvas scrolling while the combobox is open, but unbinding the …

Total answers: 2

Making a rectangle border around text in Textbox python tkinter

Making a rectangle border around text in Textbox python tkinter Question: I want to have a rectangle border around certain text that is added to the text box from the end and will be placed at the center. For example: Unfortunately, I can’t find a way to do that, because I don’t know how to …

Total answers: 4

Python3 tkinter canvas, setting relative width and height

Python3 tkinter canvas, setting relative width and height Question: I am trying to set the width of some canvas to the width of master (fullscreen) and the height to 1/5, 3/10 and 1/2 of master. Window is correctly shown, but canvas doesn’t appear. I unsuccessfully tried place() instead of pack() with relwidth = 1 and …

Total answers: 3