Grid.set_column_homogeneous crashes my computer?

Distro: Pop-os (Debian/Ubuntu)
Workspace: VSCode


I’m quite new to this so it might be a simple error.
This is the code where the error occurs:

class MainWindow(Gtk.ApplicationWindow, Settings):
    def __init__(self, settings, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Window Layout
        # self.set_default_size(1200, 500)

        # Grid
        self.grid = Gtk.Grid()

        # Add the Hours
        self.grid.attach(Gtk.Label(label=" MONDAY "), 0, 0, 1, 1)

        START_TIME_SECS = int(settings.start_hour.total_seconds())
        END_TIME_SECS = int(settings.end_hour.total_seconds())
        INTERVAL_SECS = int(settings.interval.total_seconds())

            _time = seconds_to_time(x)
            _label = Gtk.Label(label=str(_time))
            self.grid.attach(_label, x, 0, 1, 1)

I could not find anything online or someone having the same error, that’s why I’m here.
While it doesn’t make much sense, I tried doing some (limited) testing. So after restarting a few times my computer, I think these are some of the causes:

  • Commenting the for loop seems to do stop it from crashing and a window appears
  • Commenting the set_column_homogeneous stops it from crashing and the contents from the for loop appears.
  • (with the for loop commented) Adding one or two items to the grid doesn’t seem to crash my computer.

For some clarification, by crash I mean:

  • gets stuck for a while
  • my computer is unusable but music is still going abd my cursor moves
  • the window appears after a while with the everything working, however my computer starts freaking out
  • now everything is unusable and sometimes a black screen appears and disappears quickly (with the color from the login page, so the system’s default)

I could only restart my computer.

If anyone knows anything, please let me know.
– Mas


What about this line ?
It seems back to the futur.

It’s not be possible to get the ID process of this Gtk.Application to “kill” him in the PopOS Distro ?

And with propertie instead of set methode ?

Even if it was, I can’t really open the terminal. My dropdown terminal wouldn’t open even using shortcuts, same with regular terminal. I tried doing Super + Q, Alt + F4 and nothing, it was still there. I think Alt + Tab kind of worked and I was able to close other windows. But the search bar from pressing Super did not appear.

I’m going try changing some things and I’ll message you back after trying them.
The int() thing was so the range() worked okay, it was just a quick way of getting around the problem temporarily. I couldn’t imagine it could be that but let’s go again i guess

I guess you meening virtual console.
What about Ctrl+Alt+F3 tty console ?

Yeah so uh, this works. It could have been that i was making a huge table in range()…

I just improved the code little bit

        hours_number = round((END_TIME_SECS - START_TIME_SECS) / INTERVAL_SECS)

        for x in range(1, hours_number):
            _time = seconds_to_time(INTERVAL_SECS * x + START_TIME_SECS)
            _label = Gtk.Label(label=str(_time))
            self.grid.attach(_label, x, 0, 1, 1)

Thanks a lot! I will mark you answer as a solution now. :smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.