Re: gtk ui

Eugene <[email protected]> Sat, 03 Dec 2005 06:19:47 +0300
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
On Fri, 02 Dec 2005 21:24:22 +0000
  Andrea Palazzi <[email protected]> wrote:

>Now a question: I'm using glade to design the UI because 
>I wanted to  learn a little of glade; so, I have this 
>gtkui.glade file that should  be put into the lyntin ui 
>directory together with the gtkui.py file.  Now, how do I 
>get from lyntin the path to the ui directory?

What you probably want is to get the path from your 
module.
You can use the "__file__" predefined module attribute:

import os
module_filename = __file__
directory = os.path.split(module_filename)[:-1]
glade_filename = os.path.join(directory, "gtkui.glade")

or just:

glade_filename = 
os.path.join(os.path.split(__file__)[:-1], "gtkui.glade")

--
Eugene
---
Professional hosting for everyone - http://www.host.ru


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click