tags:

views:

103

answers:

2

i'm doing application that locks the PC using pyGtk, but i have a problem, when i click on the ok button the function of the button should get the time from the textbox, hide the window then sleep for a while, and at last lock the pc using a bash command. but it just don't hide.

and here is the complete program

+1  A: 

Provided you are using Gnome on Ubuntu

import os

os.system('gnome-screensaver-command –-lock')
TheOtherGuy
His problem is that his window isn't hiding.
DoR
i already use this command to lock my screen but i need to hide the window
Seif Sallam
+1  A: 

Is there any reason for the main class to be a thread? I would make it just a normal class, which would be a lot easier to debug. The reason its not working is that all gtk related stuff must happen in the gtk thread, so do all widget method calls like this: gobject.idle_add(widget.method_name). So to hide the password window: gobject.idle_add(self.pwdWindow.hide)

You'll have to import gobject first of course (You might need to install it first).

EDIT: I don't think that that was your problem, either way I edited your program a lot, here is the modified code.

DoR
i tried what u said but the same problem occur
Seif Sallam
Can I see your modified code?
DoR
I just noticed that you updated the link to your code see my edited answer.
DoR