FAQ Database Discussion Community


Converting PostScript to an image [closed]

python,image,tkinter,postscript,tkinter-canvas
I'm having trouble converting a postscript (.eps) file to any kind of image. Whenever I use PIL to save the loaded .eps file the quality of it is horrible and text rendered in tkinter is unreadable. I think this is because the .eps file is some sort of vector image...

Is there any way to incorporate collisions in Tkinter? [closed]

python,tkinter,tkinter-canvas
Just wondering if there was any easy way to create collision events on a Tkinter canvas, as I am attempting to create a game in Tkinter. I have seen some complex ways, but I was wondering if there was a simple solution. I have been using Tkinter much longer than...

Python Tkinter Scrollable Frame Class?

python,tkinter,scrollbar,tkinter-canvas
I would like to make a Tkinter class, based on the answer here, which is a Frame that automatically shows/hides Scrollbars around the content as necessary. The answer that I linked to above works perfectly for my needs, with the caveat that because it's not contained within a class, it's...

tkinter picture error: “images may not be named same as on main window”

python-3.x,tkinter,tkinter-canvas
I'm trying to write a tkinter version of flappy bird, and I came across an error that I've never seen before while working with tkinter. I've searched around everywhere, and tried everything I can think of. This is my code so far: from tkinter import * root = Tk() canvas...

Is Tkinter.Canvas a classic class?

python,python-2.7,tkinter,tkinter-canvas
I would like to know if Tkinter.Canvas is a classic or modern Python class, because super does not work as expected (for me).

resizing tkinter window for full screen

python,canvas,tkinter,tkinter-canvas
I know there's a ton of postings like this one. However, I don't think I've come across one with quite this question. I know the following will grab the current width and height of the screen and set the tkinter window to be this size and then similarly for the...

Attribute error in opening file dialog in python GUI using tkinter

python,python-2.7,python-3.x,tkinter,tkinter-canvas
I am starting to learn Python and the tkinter package and I am writing a program to load a text file on the GUI window. To open the file browser, I installed the button and its necessary function as shown in the below code. The program runs but when I...

Binding a key press event on a Canvas widget

python,tkinter,tkinter-canvas
I've binded a key to my canvas through: self.canvas.bind("<w>", lambda event: self.canvas.focus_set()) Now, what do I do so when that key is pressed, it calls a specific action, like move an object up on the canvas?...

Tkinter updating matplotlib figure from different tk.Button in another frame

python,matplotlib,tkinter,tkinter-canvas
I'm building a GUI using Tkinter for the first time and have run into a problem updating the data in a Matplotlib Figure using a button in a different frame. Below is some generalized code to show the error I'm getting. from Tkinter import * import numpy as np import...

TKinter: Move while key is pressed, stopped when not

python,canvas,tkinter,tkinter-canvas
I am trying to create a "smoother" movement with my ball. Basically, I want my program to detect when a key is press, and have it move the ball at a constant speed, and when the key is not pressed, to have it stop. This is my code: import time...

Tkinter canvas.coords method not working with tuple

python,tkinter,tuples,coords,tkinter-canvas
I'm having a bit of trouble with the following code - No matter what I try, the coords function returns an empty list when I use a tuple of tags. def drop_line(self, event): """ Function to call when the mouse is released. Creates a permanent bond between people. """ self.delete_temporary()...

Why does the update method in Tkinter cause the window to freeze?

python,tkinter,tkinter-canvas
First of all, I know Tkinter isn't thread safe and this problem has something to do with that but I wanted to find out formally why this code makes a window that displays but is unresponsive. from Tkinter import * root = Tk() c = Canvas() c.pack() c.create_line(10,10, 30, 30)...

Tkinter background colour issue

python,tkinter,tk,tkinter-canvas
I have a script that has a Tkinter module in it that i would like to change the background color in 3min intervals e.g green for 3mins then orange then red. I have the code to display the green but can't get it to change. When I make a function...

How can I bind multiple canvas elements together in order to change their color simultaneously?

python,user-interface,tkinter,tkinter-canvas
So, these are the lines which I have created/drawn: from tkinter import * root = Tk() f= Frame(root) f.pack() c = Canvas(f,bg = "black") c.pack() line1 = c.create_line(10,0,10,50,fill = "white",activefill = "blue",tag = "one") line_side1 = c.create_line(0,25,10,25,fill= "white", activefill = "blue",tag = "one") line2 = c.create_line(30,0,30,50,fill = "white",activefill = "blue",tag...

tkinter histogram prints downwards

python-3.x,tkinter,tkinter-canvas
I am trying to draw two histograms alongside one another using tkinter canvas. Everything sort of works ( looks extremely scruffy at the moment) but the histograms are drawn downwards. I have tried making the y0 value negative, but then nothing at all is drawn. I am using two lists...

(Python-3) How do you maintain the value of a variable that was changed by the program it was ran by?

python,python-3.x,tkinter,persistence,tkinter-canvas
I am currently trying to build my first GUI application through python's standard Tkinter. I soon came to grips with the computers coordinate system, and indeed I found I could pan things out as I so wish, but I came to the realisation that a drag and drop feature would...

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

python,tkinter,tkinter-canvas
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...

scroll bar tkinter not scrolling

python,tkinter,scrollbar,tkinter-canvas
#declare gui object and classes app = Tk() #creates instance of Tk() app.title('Check sort DCA') # sets title of gui #--------------------------------------- def keepSuggested(): #button press actions es.JournalOut('test2') def UseNew(): es.JournalOut('test1') #------------------------------ frame=Frame(app,width=500,height=500) frame.grid(row=0,column=0) canvas=Canvas(frame,bg='#FFFFFF',width=500,height=500,scrollregion=(0,0,500,500)) hbar=Scrollbar(frame,orient=HORIZONTAL) hbar.pack(side=BOTTOM,fill=X)...