tkinter-canvas

Widgets become invisible when i shrink my window - Tkinter - Python

ε祈祈猫儿з 提交于 2019-12-11 20:21:46
问题 I have been creating a GUI application for university using Tkinter and python. I am however having a problem where when the application first loads, or when i make the window smaller, the only widget visible is the Plotter (extends canvas) widget. If i expand the window however, the others become visible. This is my code: from assign2_support import * import tkinter as tk from tkinter import * from tkinter.messagebox import * import random from tkinter.filedialog import askopenfilename def

Using tkinter — How to clear FigureCanvasTkAgg object if exists or similar?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 19:37:02
问题 Trying to create a tkinter based window that allows user to create a chart on button click, refreshing the chart -- not adding another, each time. All without creating a new window. The idea is click -> create chart, click again -> replace the chart with new chart in same spot. No extra clicks, no extra button to close. Using matplotlib.backends.backend_tkagg and FigureCanvasTkAgg. Documentation appears to be virtually non-existent on this. Tried various attributes in .get_tk_widget() to see

Why my scrollbar and canvas doesn't synchronise?

谁说胖子不能爱 提交于 2019-12-11 17:33:38
问题 I have created a scrollable canvas. In which a frame window is there and there are many canvases in it which shows data in form of various labels? Actually I have created everything like frame configuration to update canvas scollregion but I sometimes randomly gets a bug that is when I destroy a canvas in a frame then sometimes the size of scrollbar adjust automatically but sometimes it doesn't change and scollbar shows a region with no data a large blank space at the bottom is generated

Tkinter Scrollbar not working

吃可爱长大的小学妹 提交于 2019-12-11 16:24:16
问题 I have a piece of tkinter code running on python 3.4 that is a large frame placed in a canvas with a vertical scrollbar, however the scrollbar is grayed out and doesn't seem to be linked to the size of the frame. The code I'm using is essentially: class EntryWindow: def __init__(self, master): self.master = master self.master.minsize(750, 800) self.master.maxsize(1000, 800) self.canvas = tk.Canvas(self.master, borderwidth=0, bg='#ffffff') self.vsb = tk.Scrollbar(self.master) self.master_frame

How to make buttons appear behind a background, or make the buttons background transparent?

纵然是瞬间 提交于 2019-12-11 15:17:39
问题 (Note: The buttons with borders are part of the background) I would like to place the real buttons behind the image so it would like i'm pressing the button in the background, however, i'm actually pressing the button behind it. def __init__(self, parent, controller): tk.Frame.__init__(self, parent) self.controller = controller background_image = tk.PhotoImage(file="Mainmenu.png") # Displays whats in the file background_label = tk.Label(self, image=background_image) # Makes tk.Label display

Tkinter Canvas reset ID's

ぃ、小莉子 提交于 2019-12-11 13:22:53
问题 I am coding a Tkinter GUI for a senior research project at school. I need to, at some point in the code, reset the counter used to create id values for new additions. Does anyone know if this is possible beside replacing the entire canvas? Basically, after adding a bunch of lines and ovals, I need to delete them all and restart the counter at 1 for new ones. Second, I have taken the path of replacing the entire canvas, and afterwards, nothing EVER shows up in the winfo_get() method. Why could

Python tkinter snake game drawing lag

自作多情 提交于 2019-12-11 12:51:52
问题 #example snake snake = [[1, 2], [1, 3], [2, 3]] def draw(): canvas.delete('all') for segment in snake: y = segment[0] * 10 x = segment[1] * 10 canvas.create_rectangle(x, y, x + 10, y + 10, fill="red") canvas.update() I have created a simple snake game in python using tkinter but the movement slows down rapidly when the snake array contains 30+ rectangles, so i was wondering is there a better way to do the drawing of the objects so it works faster instead of constantly calling this draw

Why is the Tkinter Scroll Bar only active when you hover over it?

心不动则不痛 提交于 2019-12-11 10:53:19
问题 I am using Tkinter to create a GUI and the scroll bar is only active when I put my mouse over it and scroll. Is there a way so I can scroll using my scroll wheel on the mouse when the mouse is not on the scroll bar and in the middle of the window? import Tkinter as Tk from Tkinter import StringVar class Example(Tk.Frame): def __init__(self, root): Tk.Frame.__init__(self, root) self.canvas = Tk.Canvas(root, width=200, heigh=200, borderwidth=0, background="#ffffff") self.frame = Tk.Frame(self

Animating an object to move in a circular path in Tkinter

时光总嘲笑我的痴心妄想 提交于 2019-12-11 07:23:32
问题 I am trying to model a simple solar system in Tkinter using circles and moving them around in canvas. However, I am stuck trying to find a way to animate them. I looked around and found the move function coupled with after to create an animation loop. I tried fidgeting with the parameters to vary the y offset and create movement in a curved path, but I failed while trying to do this recursively or with a while loop. Here is the code I have so far: import tkinter class celestial: def __init__

Python tkinter window background/canvas not changing colour

那年仲夏 提交于 2019-12-11 07:15:47
问题 I am coding a drawing program and I am trying to make an option to change the canvas background colour but for some reason it doesn't work. There is no error message and I have no idea why it doesn't work as I used pretty much the same code for changing the line colour. P.S. I am very new to python. Code: from tkinter import * # canvas specifications/variables canvas_height = 400 canvas_width = 600 p1_canvas_colour = "white" p1_canvas_colour_number = 1 #p1 (what you draw with) specifications