Tagged Questions
-1
votes
0answers
12 views
Python Tkinter ttk use in class
I'm trying to implement ttk with a grid, much like this tutorial.
The code I have right now is working good, and I should say I'm a beginner in Python, but I need help how to create a grid to place ...
0
votes
0answers
9 views
How to update image at different location in Tkinter
I'm trying to use the paste(im, box=(4-tuple)) method to update a shown image in a Label created in Tkinter(python) window.
Following code is a minimal example showing what I'm doing. The background ...
0
votes
0answers
18 views
Taking a function stdout output to shell and print it tkinter
i am using the pafy module to download youtube videos,but in one of the pafy functions, called "download" it prints to the screen the progress of the download, i would like to take that output and put ...
1
vote
1answer
11 views
not able to get root window resize event
im trying to display the size(dimension) of the root window (top level window) on a label. whenever the user resize the window, new window dimensions should be displayed on the label. I tried to bind ...
0
votes
0answers
20 views
How to make Tkinter object oriented? [on hold]
Ok, I wrote code using Tkinter to make a counter. I have been asked to make this code object oriented. I don't really know how to do that at all so if someone could show me the best way to do this ...
0
votes
2answers
23 views
How do I check if a button exists in tkinter?
So I'm making a Tic-Tac-Toe program because I'm bored. I am using tkinter, and I have a program that asks which side you want to be, then a window pops up with 9 buttons. When one of these buttons is ...
-5
votes
1answer
20 views
How do I make a button in python operate a counter?
How do I write a program in Python that shows a window with a button and a label. I want the label to update each time the button is pressed and show how many times it has been pressed.
This code will ...
1
vote
0answers
17 views
Unable to display PIL Image inside Canvas
I'm trying to display a PIL.Image inside a tkinter.Canvas:
from tkinter import *
from PIL import Image, ImageTk
root = Tk()
root.geometry('500x400')
canvas = Canvas(root, width=500, height=400)
...
0
votes
2answers
17 views
python: after method - screen loads with everything on it already
I want these 10 letters to appear one-by-one on the screen every few seconds. For some reason, when I use the "after method", it waits till all the letters are loaded internally and then shows the ...
-1
votes
1answer
16 views
Python Tkinter: Color changing grid of buttons?
I understand that you can make a button that can do some actions when clicked with Tkinter, but how can I just make a button that turns from one color to another when clicked? Then, from that, how do ...
0
votes
0answers
24 views
How to create fast pixel display in Python?
I've created a Python module which enables programming students to draw pictures pixel-by-pixel. For example, following code draws a red diagonal on a 100x100 "canvas" and shows it:
from pixboard ...
-1
votes
0answers
15 views
Python 2.7 - Tkinter user entry prompt
Okay, so I'm attempting to deploy a Tkinter prompt into my script to simply read the user entry into the "ROOTDIR" variable.
Below is a Tkinter script that seems ideal for what I'm attempting to ...
0
votes
2answers
38 views
Python 3 How do I temporarily disable tracing variables
I am using Python 3.4.1 on windows, if that should help.
Q1: How do I temporarily disable tracing variables
I have a variable field with at trace, and I would like to temporarily disable the trace so ...
0
votes
0answers
30 views
merge images into single file in python
I've a small code which will take the path to the folder(where images are located) and then when the button in the gui is pressed it creates a grid with the images in the folder.
Now my problem is i ...
0
votes
0answers
17 views
call inner function from tkinter Button
i have an button
b3 = Button(master, text="Answer", width=14, height=3, command=lambda: sendMessage())
and worker() function which has inner function sendMessage(). i put sendMessage() in worker() ...
0
votes
0answers
14 views
Binding an event to a Tkinter Menu widget (on Windows)
I would like to know if it's possible to bind events to a Menu widget in Tkinter on Windows and have that event trigger successfully. Everything I'm trying tells me that everything works except for ...
2
votes
1answer
19 views
Tkinter root configuration
For adding a title to the TKinter root, we do something like
root = Tk()
root.title("<Title Text>")
root.configure(bg = "<color>")
My question is how do we change the font size and font ...
1
vote
1answer
28 views
Create scrollbar only when text length greater than text area
Here is some simple code:
from tkinter import *
from tkinter import ttk
rootwin = Tk()
roomtext = Text(rootwin)
roomtext.pack(side = 'left', fill = "both", expand = True)
rtas = ...
2
votes
0answers
30 views
Adding Pan, Zoom and Autoresize window without Matplotlib
I wrote a code that enables the user to choose an image file and then displays it into a canvas. Now I need the window to auto resize (adapt to image dimension) and I need to add a Pan and a Zoom ...
0
votes
2answers
26 views
Tkinter grid() alignment issue in python
I have been working in python for the first time and basically I am trying to get these to labels to align in the correct columns and the correct row but for some reason it doesn't move down rows and ...
0
votes
1answer
15 views
Pillow OSError when loading into tkinter using Python 3.4
I am loading an image from a server, and I keep getting this error when I use Base64 on the data.
Here's my code:
import tkinter as tk
from PIL import ImageTk
root = tk.Tk()
import urllib.request
...
-3
votes
2answers
47 views
Why does my window reopen when closed?
I was testing my friend's Tkinter code, and came across this bizarre behaviour.
When I use the Windows 'X' button (top-right of window) to close this Tk window (class/method?), it closes, then ...
0
votes
1answer
27 views
Getting data from a long function to update a GUI
I've got a GUI which gives the user the option to run a selection of tests.
These tests run in threads as they use MIDI data in.
I have a checkQueue() function that is run using after() but once the ...
1
vote
1answer
37 views
Tkinter GUI, Open File .. Button and BMP images .. Error on showing a selected file
So I'm doing a program that is written in Python and what it should do is Displaying a GUI with a button there to open a image file, and then you'll should be able to see those image, pan and zoom on ...
-1
votes
2answers
32 views
Switching between frames in tkinter menu
I've used Tkinter to create a GUI with different menu options (a similar example is produced below). Each menu has different commands, which when clicked create a new frame. Now what is happening is ...
0
votes
1answer
20 views
tkinter open video in the same window
I'm trying to create a video player with tkinter and gstreamer, my code works, but is shown in a xwindow, how can I display it in the frame that I have prepared for it?
def init_window(self):
...
3
votes
1answer
35 views
How to disable selecting text in a Python/Tk program?
How would that be done?
I have been unable to find it on here or with Google.
#Refrences
from tkinter import *
class Interface:
def __init__(self,stage):
topLeft = ...
0
votes
0answers
16 views
How can I rotate a rectangle to point towards a specific point in Tkinter?
I have a program in which a Robot (rectangle ) has to move towards a ball ( a red circle) with fuzzy logic. I can easily get the x and y coordinates and move the robot towards it. But I´m having ...
-4
votes
0answers
33 views
Python graphics: Working with Python's Graphics package
Hi I have an assignment that I've been stuck on all weekend and have been trying to figure it out to no avail. The question is as follows:
Write a function, compareFibs, that opens a window, and ...
-2
votes
1answer
26 views
Creating a GUI with Tkinter of Python
I have written the following code:
from Tkinter import *
root = Tk()
root.title("Power Method")
labeltext1 = StringVar()
labeltext2 = StringVar()
labeltext1.set('Parameters') # Set start value
...
0
votes
1answer
18 views
Why Is Tkinter Key Bind not working [on hold]
from tkinter import *
import sys
def Movement(event):
print(event)
def Start():
window = Tk()
window.title("Game")
window.geometry('700x300')
frame = Frame(window, width = 700, ...
-1
votes
1answer
28 views
Python 3.3 Tkinter LabelFrame resizable
Is it possible to create a resizable LabelFrame?
Or any way?
And is it possible to use ttk.PanedWindow with LabelFrame for this?
it's my code:
fram1 = ttk.LabelFrame(root, text = "text1", height = ...
2
votes
0answers
31 views
When importing tkinter's “messagebox” module, does the “import tkinter.messagebox” syntax not work?
Since the "messagebox" is a module in the "tkinter" package, why do I have to use
from tkinter import messagebox
instead of
import tkinter.messagebox
I was under the impression that to import ...
0
votes
2answers
60 views
Using two counters in a loop
I have been making a text based game at home using Python and have been having trouble with creating a small section of combat between the player and a foe. The combat is supposed to include two ...
2
votes
3answers
53 views
Triangle with points on perimeter of circle, python
I have to make a triangle with 3 random points on perimeter of a circle, that has random center coordinates x and y (random_x and random_y in the code). It takes radius as an input from user. And the ...
1
vote
1answer
17 views
Is there a tkinter equivalent for Perl/Tk's Scrolled pseudo-widget?
Perl/Tk has a pseudo-widget Tk::Scrolled that takes as its argument another widget and adds a corresponding scrollbar according to options (where to put it in relation to the widget and if to show at ...
-4
votes
0answers
31 views
Python Class structure [on hold]
import sys
from tkinter import*
#Functions to handle button click
class App(object):
def __init__(self):
self.master = Tk()
def startgame():
player21abel=Label(self.master, ...
-4
votes
2answers
37 views
Python - How to get string in a Function?
I am currently writing a hang man game. Using Tkinter for GUI.
How can I get a string from a function:
def startgame():
player21abel=Label(text=" Guess a Letter ...
0
votes
3answers
26 views
Python: Listbox without border
I want to get a table, but when I realized, that there's no table in python, I decided to fix it with two listboxes.
The point is, that I don't want a border between them.
So my Question is: How to ...
0
votes
1answer
27 views
Invalid command name while executing (“after” script)
As solve this problem? I'm running this code, window is created, but in console appears message on the error. I think problem the fact that is "after" loop not terminate but the window already ...
0
votes
1answer
25 views
Multithreading with Tkinter
I'm having some issues with a Tkinter-based GUI. Basically the GUI creates lots of threads and run them. When each thread has finished, I'd like it to update a label to inform the user of this ...
2
votes
1answer
17 views
tkinter mac, minimize screen
I'm using tkinter in python for mac.
Simply put, I want to override the "minimize" button's functionality.
I'm already overriding the "X" button functionality in this fashion:
root = Tk()
...
0
votes
1answer
61 views
Python: initializing method in class
I created a simple program that displays 28 numbers on the screen. Currently, nothing happens when you click on the numbers. Eventually, I want the numbers to disappear on click. Also, when you click ...
0
votes
1answer
18 views
Python Tkinter: create a menu button on the right side
I am able to create a window with a menu and its sub-menus. However, I would like to create a single MenuButton on the right side. How do I do that?
menubar = Menu(self.parent)
...
0
votes
1answer
27 views
call function after certain time and kill on button press, tkinter
I have made an entry widget and it gets the number entered when they click OK (this becomes the number of seconds for function to recur(n)), I want to call the function every n seconds. When OK is ...
0
votes
0answers
19 views
tkinter and mayavi conflict - anaconda on OS X
I just recently started working with mayavi, and in order to get that library built and functional I ultimately turned to anacoda which made getting it working insanely easy.
I was originally working ...
0
votes
1answer
37 views
Tkinter calculator, can only do 1 operation
import tkinter
import tkinter.messagebox
import sys
top=tkinter.Tk()
from tkinter import*
def clear():
e1.delete(0,END)
return
def seven():
v.set(v.get()+str("7"))
v.get()
def ...
0
votes
2answers
26 views
How can I get my animation loop working?
I have been trying to implement an animation loop to work around the slight delay I was getting when moving a canvas item after hitting an arrow key but am now stuck. My code is shown below and I ...
0
votes
1answer
20 views
multi line Tkinter button?
i have the following button:
option1=tkinter.Button(opt1,text='this is a test to see how many words we can fit in a button and stuff so heres some more words',width=49,height=3,bg='grey',)
this ...
-2
votes
2answers
24 views
How do I delete a label off of the screen in a python Tk GUI
#here is the example code:
label1 = Label(app, text="This is a Label!")
label1.pack()
#But when i do:
label1.pack_forget()
#I get this error:
#AttributeError: 'NoneType' object has no attribute ...