Ok, then append option "--display=:0.0" to the command.
Because display is opend with your (non-root) user.
You should add line "export XAUTHORITY=~/.Xauthority" to your "~/.bashrc"
file to avoid such problems.
This a linux dependent article and not about pygtk.
You can ask your linux questions in #ubuntu channel on irc.freenode.net.

On Thu, Jun 17, 2010 at 2:44 PM, KB SU <k24...@gmail.com> wrote:

> yes, i run it as root, with sudo command.
>
>
>
> On Thu, Jun 17, 2010 at 3:09 AM, Saeed Rasooli <saeed....@gmail.com>wrote:
>
>>
>>
>> On Thu, Jun 17, 2010 at 12:16 PM, A.T.Hofkamp <a.t.hofk...@tue.nl> wrote:
>>
>>> KB SU wrote:
>>> > Hi,
>>> >
>>> > I have Ubuntu: Ubuntu-Server 9.10 _Karmic Koala_ - Release i386
>>> > Python: 2.6 and gtk 2
>>> >
>>> > But when I try to import gtk, it gives warning like:
>>> > /usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py:57: GtkWarning:
>>> could not open display
>>> >   warnings.warn(str(e), _gtk.Warning)
>>> >
>>> > Is there any way to solve this problem?
>>> >
>>> Giving the program an X11 display would solve it.
>>>
>>>
>>> Albert
>>> _______________________________________________
>>> pygtk mailing list   pygtk@daa.com.au
>>> http://www.daa.com.au/mailman/listinfo/pygtk
>>> Read the PyGTK FAQ: http://faq.pygtk.org/
>>>
>> do you run it as root? (or different user that the session)
>
>
>
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to