Python Forum
Gi module window freezing problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gi module window freezing problem
#1
Hello. I code the interface with the gi module. But I am having problems.

For example, the window is frozen when for loops occur. the window will freeze and the window will not react when the terminal side processes occur. What is the solution?

Example Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
 
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import os
 
class Window(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self, title="Window")
        self.connect("delete-event", Gtk.main_quit)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.unmaximize()
        self.set_resizable(False)
 
        self.box = Gtk.Box()
        self.add(self.box)
 
        self.button = Gtk.Button(label="Click")
        self.button.connect("clicked", self.click)
 
        self.progressbar = Gtk.ProgressBar()
 
 
        self.box.pack_start(self.button, True, True, 1)
        self.box.pack_start(self.progressbar, True, True, 2)
 
    def click(self,widget):
        self.progressbar.pulse()
        os.system("sleep 2")
        self.progressbar.pulse()
        os.system("mkdir A; mkdir AA")
        self.progressbar.pulse()
        os.system("rm -rf A; rm -rf AA")
        self.progressbar.pulse()
        os.system("free")
        return False
 
 
    def main(self):
        self.show_all()
        Gtk.main()
 
win = Window()
win.main()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Kivy] Asynchronous operation without window freezing T800 0 729 Dec-06-2024, 05:40 AM
Last Post: T800
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 2,641 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  [Tkinter] GUI keeps freezing Fre3k 2 4,857 May-23-2020, 05:41 PM
Last Post: Fre3k
  tkinter window and turtle window error 1885 3 8,303 Nov-02-2019, 12:18 PM
Last Post: 1885
  [PyQt] How to open a program with python without freezing LavaCreeperKing 9 10,825 Aug-17-2019, 08:48 PM
Last Post: LavaCreeperKing
  [Tkinter] How to create a delay for AI without freezing the GUI kom2 8 7,896 May-04-2019, 02:32 PM
Last Post: Yoriz
  update a variable in parent window after closing its toplevel window gray 5 11,237 Mar-20-2017, 10:35 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020