Re: [pygtk] newbie question dialog/pop-up

2004-03-12 Thread Pierre N
On Fri, 2004-03-12 at 01:52, Alexandre Strube wrote:
> Em Qui, 2004-03-11 às 19:49, Pierre N escreveu:
> 
> > > > I advise you to have a look at the one at handheld.org:
> > > > http://handhelds.org/~nelson/pyglade/pyglade-tutorial
> > > > It's really great, and my whole application is based on this. This is
> > > > very elegant. Considering the size of my beast...
> > > On thing I find VERY confusing in all of this are those modules' names,
> > > as well as libraries versions.
> > > For instance:
> > > that helloworld example from the above page has the following line:
> > > import gtk, libglade
> 
> > > Well, ok. I don't have any idea of which library is libglade, my python
> > > cannot find it. It says "ImportError: No module named libglade".
> > I didn't even realise this, you are right. Well, just check with your
> > python env. which modules you have and which you don't:
> 
> I've been reading other tutorials... but you said that you were using
> the handhelds' one yourself, so the only thing I tried was run that
> helloworld. This made me confused...
I shoud have said I was inspired by. I have a few things which are
different. Including the use of the gtk.glade module

> > >>> help()
> > help>modules
> 
> This is good to know. I was looking for this for quite some time.
> 
> 
> > help>gtk.glade
> > [... here you go, the whole API just for you ...]
> 
> hooho! :-)
> 
> 
> > > libglade.GladeXML(file)
> > > gtk.glade.XML(file)
> 
> > different "native" lib. Here you go, you don't care which one you need.
> 
> What worries me is that I would have to convert functions from one to
> another on every different distro.
Now, that is not the case. On every distro, as long as the pygtk 2.x
package is installed you always call the gtk.glade module (if you want
to use pygtk 2.x). You can use this kind of check as well:
try:
  import gtk.glade
except:
  # Something wrong with the module

> > > What is the difference? I don't know. What are the versions? I don't
> > > know. Is one for gtk/glade 1 and other for gtk2/glade2? I don't know.
> > I suppose this is the explanation. I'm sure you can google for libglade
> > you'll find everything you need to know about libglade. On
> > http://www.python.org as well...
> 
> Libglade is from the guy who created PyGTK. In fact, it's hosted at the
> same place this list is. Ain't this ackward?
Well, if he did the two of them, and they are just different versions of
pygtk, I don't think it's ackward.

> > At the same time I think you want to know too much about everything and
> > you can't seem to see the end of it. Hard to be motivated... Just try to
> > focus on what you have/like to do. Don't try to know stuff you don't
> > need. Not yet anyway ;-p
> 
> I was just trying to run a hello world ;-)
The problem looks like this hello world is pretty old ;-p

--
Pierre



signature.asc
Description: This is a digitally signed message part
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] newbie question dialog/pop-up

2004-03-11 Thread Christian Robottom Reis
On Thu, Mar 11, 2004 at 11:20:55PM -0300, Alexandre Strube wrote:
> Em Qui, 2004-03-11 às 22:18, Christian Robottom Reis escreveu:
> 
> > > > > libglade.GladeXML(file)
> > > > > gtk.glade.XML(file)
> > > > different "native" lib. Here you go, you don't care which one you need.
> > > What worries me is that I would have to convert functions from one to
> > > another on every different distro.
> > Hmm, what do you mean by "convert functions"? Different distro?
> 
> Means that if different linux/bsd distros, for instance, use different
> versions (take a look at two different lines of them on top of the mail,
> they do the same in different libraries) of glade library, would us have
> to write code for both?

Oh, sorry; to an extent you are correct. But, being a consequence of
moving from pygtk-0.6 to 2.0, this is only the tip of the iceberg -- FAQ
section 2 outlines other changes that are necessary when moving from one
version to the other.

Most recent distributions have adopted pygtk-2.x; older applications
written for pygtk-0.6.x still need the older version (though both
coexist nicely).

In summary, yes, you'd need to convert functions if you wanted to use
both PyGTK versions, but in practice, pygtk-2.x is what you should be
targetting (IOW, forget the old pygtk-0.6.x API).

> > > Libglade is from the guy who created PyGTK. In fact, it's hosted at the
> > > same place this list is. Ain't this ackward?
> > It's not awkward; it's a statement on how much greatness he has brought
> > upon the world.
> 
> Yes, but it looks like the libglade he wrote isn't the same actually
> used by us. At least with gtk2.

As a matter of fact, he wrote both versions. What we use are wrapped
versions of the C libglade libraries; and yes, he wrote the wrappers
too .

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] newbie question dialog/pop-up

2004-03-11 Thread Christian Robottom Reis
On Thu, Mar 11, 2004 at 09:52:58PM -0300, Alexandre Strube wrote:
> > > libglade.GladeXML(file)
> > > gtk.glade.XML(file)
> 
> > different "native" lib. Here you go, you don't care which one you need.
> 
> What worries me is that I would have to convert functions from one to
> another on every different distro.

Hmm, what do you mean by "convert functions"? Different distro?

> Libglade is from the guy who created PyGTK. In fact, it's hosted at the
> same place this list is. Ain't this ackward?

James wrote both; he works at DAA, where the list and [original pygtk]
pages are kindly hosted.  

It's not awkward; it's a statement on how much greatness he has brought
upon the world.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] newbie question dialog/pop-up

2004-03-11 Thread Alexandre Strube
Em Qui, 2004-03-11 às 19:49, Pierre N escreveu:

> > > I advise you to have a look at the one at handheld.org:
> > > http://handhelds.org/~nelson/pyglade/pyglade-tutorial
> > > It's really great, and my whole application is based on this. This is
> > > very elegant. Considering the size of my beast...
> > On thing I find VERY confusing in all of this are those modules' names,
> > as well as libraries versions.
> > For instance:
> > that helloworld example from the above page has the following line:
> > import gtk, libglade

> > Well, ok. I don't have any idea of which library is libglade, my python
> > cannot find it. It says "ImportError: No module named libglade".
> I didn't even realise this, you are right. Well, just check with your
> python env. which modules you have and which you don't:

I've been reading other tutorials... but you said that you were using
the handhelds' one yourself, so the only thing I tried was run that
helloworld. This made me confused...

> >>> help()
> help>modules

This is good to know. I was looking for this for quite some time.


> help>gtk.glade
> [... here you go, the whole API just for you ...]

hooho! :-)


> > libglade.GladeXML(file)
> > gtk.glade.XML(file)

> different "native" lib. Here you go, you don't care which one you need.

What worries me is that I would have to convert functions from one to
another on every different distro.

> > What is the difference? I don't know. What are the versions? I don't
> > know. Is one for gtk/glade 1 and other for gtk2/glade2? I don't know.
> I suppose this is the explanation. I'm sure you can google for libglade
> you'll find everything you need to know about libglade. On
> http://www.python.org as well...

Libglade is from the guy who created PyGTK. In fact, it's hosted at the
same place this list is. Ain't this ackward?

> At the same time I think you want to know too much about everything and
> you can't seem to see the end of it. Hard to be motivated... Just try to
> focus on what you have/like to do. Don't try to know stuff you don't
> need. Not yet anyway ;-p

I was just trying to run a hello world ;-)


-- 
[]s

Alexandre Ganso 
500 FOUR vermelha - Diretor Steel Goose Moto Group

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] newbie question dialog/pop-up

2004-03-11 Thread Christian Robottom Reis
On Thu, Mar 11, 2004 at 02:40:53PM -0300, Alexandre Strube wrote:
> > Well, I use Glade myself and I almost did advise him to use Glade. But I
> > believe it was not answering his question, so I just kept with the 'pure
> > Python code'.
> > But I totally agree with you.
> 
> Do you have any other pygtk + glade tutorial? It doesn't look that easy
> to find something...

/me looks at Xavier

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] newbie question dialog/pop-up

2004-03-11 Thread Alexandre Strube
Em Qui, 2004-03-11 às 14:27, Pierre N escreveu:

> > > You should check out this great tutorial first:
> > > http://www.moeraki.com/pygtktutorial/pygtktutorial/index.html
> > That's a nice tutorial for learning things from scratch, but IMHO it
> > looks a little bit "raw" for a a complete dum^H^H^H newbie, which would
> > prefer learning how to program in python with GTK using glade instead of
> > managing every widget itself. 
> > 
> > I liked the article found at
> > http://www.linuxjournal.com/article.php?sid=6586
> > 
> > Seems quite adequate for someone which just wants to develop
> > applications fast.

> Well, I use Glade myself and I almost did advise him to use Glade. But I
> believe it was not answering his question, so I just kept with the 'pure
> Python code'.
> But I totally agree with you.

Do you have any other pygtk + glade tutorial? It doesn't look that easy
to find something...

> --
> Pierre
> PS: Looks like you forgot to include the list in there... Haven't seen
> your message popping up anyway.

Yes, as list was at cc: line, and I don't like to do a "reply to all"...


-- 
[]s

Alexandre Ganso 
500 FOUR vermelha - Diretor Steel Goose Moto Group

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] newbie question dialog/pop-up

2004-03-11 Thread aviad cohen
Pierre N wrote:

Hi,

You should check out this great tutorial first:
http://www.moeraki.com/pygtktutorial/pygtktutorial/index.html
You'll see that the easiest way to achieve this is to create a class
where you initialise all your windows/dialogs (and you hold a reference
to all of them) and another one where you handle all the events. From
the event_handler (on_bla_button_clicked) you can then call methods
which are going to give you references to these windows/dialogs:
win1=main.get_window1()
win2=main.get_window2()
win1.show()
win2.hide()
 

sorry, but i didn't understands how to call diferent files/classes
it's seems not logical to load all the windows and then to handle them
since, if the user didn't "clicked" to show a window why should i
load it?
i would be very happy to get some example code that shows how
to use several files and classes
i did looked at the pygtk-demo.py but it was not what i was looking for
thanks again
aviad
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] newbie question dialog/pop-up

2004-03-11 Thread Pierre N
Hi,

You should check out this great tutorial first:
http://www.moeraki.com/pygtktutorial/pygtktutorial/index.html

You'll see that the easiest way to achieve this is to create a class
where you initialise all your windows/dialogs (and you hold a reference
to all of them) and another one where you handle all the events. From
the event_handler (on_bla_button_clicked) you can then call methods
which are going to give you references to these windows/dialogs:

win1=main.get_window1()
win2=main.get_window2()
win1.show()
win2.hide()

After you get this running, you can go into more advanced way of
managing this, like you'll find here:
http://www.pygtk.org/articles.html

And this nice FAQ has a few great tricks:
http://www.async.com.br/faq/pygtk/index.py?req=all

I'm finishing the development of such an application using over 35
windows. All running like a stack. It's a great experience and (I
believe) it works great!! I'm using Glade though...

--
Pierre


On Thu, 2004-03-11 at 20:38, aviad cohen wrote:
> hello everyone
> i have a question about  dialog/pop-up windows
> 
> i'm trying to write a program that would show a menu of items.
> when the user opens an item (meanning clicks on the button)
> the main window would hide ( self.window.hide() ) and a new window
> would open instead .
> 
> when the user finished with the child window and press the "x" button
> the window would then be closed and the main (previous) window would be 
> shown
> again (self.window.show)
> 
> some time ago i did this task with action-listener (using java)
> or post-messege (using c++ and mfc)
> 
> my REAL problem is to understand if this structure would be
> dialog based like or open a new window new windows.
> 
> i wrote an eample code:
> .
> file main1.py:
> --
> import gtk
> import another_file_module
> 
> class main1(gtk.Window):
>   def __init__ ...
> 
>   def clicked_on_button
> new_win=another_file_module.main_1()
> new_win.show_all()
> self.window.hide()
> 
> file another_file_module.py
> --
> 
> import gtk
> class main_1(gtk.Window):
>   def __init__ :
> .
> .
> gtk.Window.__init__(self)   
> self.connect('destroy') -> what should i write here in order to close
> this window and show the main1 
> window again
> .
> .
>   
> 
> thanks
> aviad
> ___
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


signature.asc
Description: This is a digitally signed message part
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/