72 questions
1
vote
1
answer
74
views
Python Tkinter: wait for user input before continuing with the mainloop
I am using Tkinter with Python 3.11 on Windows.
The following program creates a simple window with a menu. The user would click "Game -> Select game directory", whereupon ...
0
votes
0
answers
43
views
Python // Freezing Tkinter Window
coming from an amateur level of javascript I just started messing around with python and tried to write a small script that checks if a lock file (selected by the user) exists over and over again and ...
-2
votes
1
answer
137
views
How can I pause my code until a toplevel window is destroyed?
I try to add Error-Messages to my code. Each of those I want to display in a separate tkinter Toplevel window. So far so good.
But for this I need to pause my code after the Error-Window was created ...
0
votes
0
answers
74
views
How to make a custom event loop in Cocoa?
I need to implement a custom Cocoa main loop using metal-cpp (the source code is also available here). I use an extended version of metal-cpp, so all called below methods were implemented in my ...
1
vote
2
answers
120
views
Is it possible to integrate GLib mainloop into another?
I have a 3rd party library with mainloop. I want to use GLib/Gtk with the app I'm developing. Is it possible to integrate GLib mainloop into another host?
The host loop allows to register an fd and ...
0
votes
1
answer
176
views
looking for Tkinter mainloop() alternative that continues code after window is destroyed
I am looking for Tkinter mainloop() alternative that continues code after window is destroyed. Currently my code is written as follows:
root = tk.Tk()
recObj = Twiz_Soft.Recorder()
app = MyApp(root,...
0
votes
1
answer
835
views
In Tkinter, why shouldn't .mainloop() be used with Toplevel() windows, and what is the proper way of doing it?
Currently, whenever I create a new window in a Tkinter program, I use a function with Toplevel(), including .mainloop(), like this:
def MainWindow():
root = Tk()
#A button that calls SubWindow(...
0
votes
1
answer
36
views
How to make a menu widow within the for loop?
So I am trying to make a matrix 6x6 with buttons. When I right click on the a button, the menu window should pop up with a list of options. In this case, it's mix and escape. When I click on any of ...
0
votes
1
answer
121
views
Tkinter window says not responding but code is running
I am trying to make an antivirus application but I met some issue. And Tkinter window says (not responding) but code is running. I wanted to use threading, but firstly it's not convenient, secondly it ...
0
votes
1
answer
780
views
Rust Win32 window, peek message disabling main loop exit
I am new to Rust and i am learning it, however when i search for information around this issue, there is simply no information.
The problem exists in the main loop of the program for which the code ...
0
votes
0
answers
85
views
Multithreading while in main loop C++
I'm trying to write a simple console game, space shooter -ish.
The game runs on main loop.
I want to use multithreading to manage shooting projectiles and another for movement of the enemy.
How should ...
0
votes
2
answers
358
views
tkinter mainloop() not ending the script once it completes
For some reason the mainloop() is not ending. The final print statement never gets triggered but everything else does. Any idea what is causing this or how to resolve it? It happens even without the ...
1
vote
1
answer
1k
views
Tkinter: error main thread not in mainloop
this question has been asked many times but to be honest I don't quite understand why do I get this error "RuntimeError: main thread is not in main loop". I have the following code to read ...
2
votes
2
answers
1k
views
Tkinter, update widgets real time if list is modified
Let say I've a list of widgets that are generated by tkinter uisng a loop (it's customtkinter in this case but since tkinter is more well known so I think it'd be better to make an example with it), ...
0
votes
1
answer
55
views
how to make a code that does 2 processes in python
i made a messenger that works with the socket library. it has 2 sides : server and client.
i later decided to make a GUI for it , too. ( with tkinter )
when i was making it , i realized that programs ...
0
votes
1
answer
114
views
Continue executing function
When closing an instance of the ChildWindow class, which was called from another instance of MainWindow, the code does not continue to be executed.
I noticed that only when the MainWindow instance is ...
0
votes
0
answers
69
views
Tkinter using mainloop and another loop
I'm doing a project where I read info from a socket and then intend to display it on a gui using tkinter. The thing is, my read info from socket is a loop and for the gui I need another loop.
I'm ...
4
votes
2
answers
2k
views
Can you call mainloop() more than once in tkinter?
What I mean by this is can you make the program open the window more than once by putting the mainloop() function in a for loop or a while loop? It would probably look something like this:
for i in ...
0
votes
1
answer
1k
views
tkinter code after mainloop() not being executed after closing window
I need help using tkinter in python.
I want to use a while loop inside my class so that it keeps printing in the terminal the content of an entry (box1). But the problem is that if I put a loop in my ...
0
votes
1
answer
140
views
There is a way to wait on a user's answer in tkinter?
I'm developing an application what have its functions set in different files.
The main file have a tkinter interface and the buttons, entrys and labels are in other file, like this:
Mainfile.py
from ...
1
vote
1
answer
80
views
simple Tkinter program - window vanishes after clicking button - maintop problem?
Coders,
I guess I have a newbie question: my windows disappears when I click on a button. If I put in root.mainloop() as last line in the buttonClicked-function, then the program is fine - but it ...
0
votes
0
answers
202
views
Tkinter function call does not return value
I intend to collect names in lists that will be used in a program, one at a time. The function does return a list and the whole program runs once, but after I call the function UserInput with the ...
1
vote
1
answer
1k
views
how to pass a function with parameters to after method of tk?
I want to run a function alongside the main loop of a window. I have this code:
from tkinter import *
window = Tk()
def task():
print("hello")
window.after(1000, task)
window....
0
votes
1
answer
113
views
Replaying the main loop with a few changes pygame
I have been trying to make a Fangame for Undertale with pygame but i am stuck. This is my first project. I want to replay the main loop with a few changes, for example i want the knife movement to be ...
0
votes
2
answers
82
views
How do I get the return from button
how do i get the return from button command
also tried without lambda doesn't work
import tkinter as tk
#value = ''
def button(e,f):
#global value
value = e.get()
f.destroy()
return ...
-1
votes
1
answer
148
views
Why no code is executed after mainloop tkinter python
I know what is the purpose of mainloop (or at least i think), also i know that code placed after mainloop can be executed using after(), but why is like that? Why is mainloop blocking it?
1
vote
1
answer
943
views
Understanding mainloop() better
My understanding of tk.mainloop() was that it would run and handle the events of window related to the first created Tcl interpreter and <widget>.mainloop() would handle the events of the window ...
0
votes
1
answer
629
views
How to Stop Tkinter Program When Using a Class
I'm using python to create a class object that controls a Tkinter window. My code looks like this:
class MyGui:
def __init__(self):
self.root = tk.Tk()
self.root....
0
votes
1
answer
260
views
Main loop doesn't exit SDL2, C++ [closed]
I'm trying to do a very basic main loop with SDL2 but the window opens and I can't close it.
I've written this code:
bool open = true;
while (open = true)
{
SDL_Event event;
while (...
0
votes
0
answers
79
views
tkinter problem with sockets and mainloop
im working on a project for my networking class which is a 2 clients plaing 4 in a row
I have almost everything figured out but i have one major issue, i need to get data from the server and in the ...
0
votes
1
answer
213
views
When you call mainloop in tkinter, do you need to call it in the first window that will be opened?
I'm making a login system, and I called mainloop in the first window that will be opened upon starting the program. This window is the window which asks whether the user would like to login or ...
3
votes
1
answer
913
views
Python + Tkinter: "AttributeError"
I also have not a lot of practice with Python and have a fundamental problem of understanding the error: AttributeError: 'NoneType' object has no attribute '_root', which only appears, when I define ...
1
vote
1
answer
335
views
Tkinter mainloop broken, messagebox keeps popping up [duplicate]
class StartUp():
def __init__(self):
pass
def verify(self):
username = ("s")
password = ("s")
usernameEntry = usernameVar.get()
...
0
votes
0
answers
87
views
Tkinter - Tk and TOPLEVEL Window-Mainloops Conflict
i have again an issue, that i did not figured out why.. All needed code is summarized in this screenshot:
Code
The part in "pixela_brain.py" where the two print statements are, is the ...
0
votes
0
answers
128
views
tkinter window not showing when importing from a module
I'm having issues when I import a module that contains tkinter in it.
I don't want to paste the code because it's super long and it not my problem here, I've created a module using tkinter and ...
1
vote
1
answer
169
views
what is the function of window = Tk() in this program as leaving it out gives the same output
from tkinter import *
window = Tk()
sample = Label(text="some text")
sample.pack()
sample2 = Label(text="some other text")
sample2.pack()
sample.mainloop()
...
0
votes
0
answers
482
views
how to change tkinter widgets configure immediately in event handler
I'm a beginner and want to make a fast reading application with tkinter library.
The app consists of a Start Button and speed Entry to show the user text in the Message widget. when Start Button press,...
0
votes
2
answers
151
views
tkinter: how do I insert a delay between widget changes within the same handler?
I asked a similar question about two years ago when I was trying to emulate LEDs on a Tkinter canvas. The solution then was to use the canvas after() method instead of the sleep() function to ...
0
votes
0
answers
180
views
Python: How to remove process on background while using separate login window (tkinter)
I have got a program with GUI (Tkinter) where I want to add a login system to. I programed a login window with a several functions in a separate library Login_v1. The program and de login system works ...
0
votes
2
answers
400
views
Pygame mainloop qiuting exception handling
Hi I am writing a simple chess program, unfortunately I have run in some unexpected problems, namely. After I added a list which keeps track of all the figures positions, I cannot close the window ...
0
votes
1
answer
414
views
Python Tkinter variable inside mainloop doesnt display unless called from outside of loop
Trying tkinter for first time. The code below has 4 print# statements. Two questions here -
1)- When executing, I expected the of flow of code would be same as print# statements but seems the flow is ...
0
votes
1
answer
245
views
Don't know how to apply mainloop() in my app
I have programmed a 2600 lines application which worked great when running from the IDE. Now I have created an executable via Pyinstaller and now the GUI does not start. The application starts and ...
1
vote
1
answer
291
views
confirm and mainloop in pyautogui, and tkinter
I am looking for the way I can use x value within Tkinter widget.
I couldn't find an appropriate answer from the web.
Any advice is appreciated.
Thanks
regarding, confirm, it returns x and print(x) ...
1
vote
1
answer
4k
views
Running every GStreamer pipeline into a separate (GLib) thread
All of the GStreamer samples are initializing GLib main thread through some form of:
loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(loop);
As far as I understood this main loop is used for all ...
0
votes
2
answers
2k
views
Using Python and Tkinter, How would I run code every loop of .mainloop()?
I have a program where I need to move an image object every time the mainloop() loops. I haven't tried doing much, mostly because I don't know where to start. I made a dummy version of my project that ...
0
votes
1
answer
812
views
How to make QEMU only return to the main loop by executing one instruction at a time?
I added -fPCI to the QEMU source file compilation option and added -shared to the final link command, so that QEMU has become a shared library that can be dynamically loaded. I started trying to ...
-1
votes
2
answers
381
views
How to update a global counter
I am trying to implement a counter in tkinter. I expect it to +1 whenever I click whichever button. However, the counter value always remains the same. Here is my sample code:
import tkinter as tk
...
0
votes
1
answer
63
views
using lots of MainLoop using tkinter python
So I'm doing a project in school and I'm making a game with Tkinter (I know I could have used PyGame but We learned only Tkinter in school....)
My game using sockets as well and as you might know once ...
2
votes
0
answers
75
views
How to queue a task AFTER all widget resizing operations?
I want to query a widget's size after changing its contents. Here's a demonstration:
import tkinter as tk
win = tk.Tk()
label = tk.Label(win)
label.pack()
def callback1():
label['text'] = '...
0
votes
1
answer
69
views
Basic window with Tkinter, mainloop()
I am quite new to Python and currently learning how to create basic windows using Tkinter.
The Python documentation suggests using the following code (simplified):
from tkinter import *
class ...