Dear Ganesh,<br><br>Glade is just an user interface builder. It is just a Rapid Application Development (RAD) tool that simplifies designing the user interface. But you still need to program what the interface does. This is done by PyGTK, a toolkit, or a collection of libraries, which developers can use to
develop GUI applications for Linux, OSX, Windows, and any other platform
on which GTK+ is available. I think this tutorial may be helpful to you.<br><br><a href="http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html">http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html</a><br><a href="http://www.pygtk.org/pygtk2tutorial/index.html">http://www.pygtk.org/pygtk2tutorial/index.html</a><br>
<br><div class="gmail_quote">On Mon, Jan 30, 2012 at 1:23 PM, <span dir="ltr"><<a href="mailto:tutor-request@python.org">tutor-request@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Send Tutor mailing list submissions to<br>
<a href="mailto:tutor@python.org">tutor@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:tutor-request@python.org">tutor-request@python.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:tutor-owner@python.org">tutor-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Tutor digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: Deleting an object (Peter Otten)<br>
2. Re: Deleting an object (Alan Gauld)<br>
3. Re: Socket Programming (Navneet)<br>
4. Re: Why do you have to close files? (amt)<br>
5. loop until a keypress (Surya K)<br>
6. Help Glade Tutorial. (Ganesh Kumar)<br>
7. Re: Help Glade Tutorial. (Chris Fuller)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sun, 29 Jan 2012 17:34:12 +0100<br>
From: Peter Otten <__<a href="mailto:peter__@web.de">peter__@web.de</a>><br>
To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Subject: Re: [Tutor] Deleting an object<br>
Message-ID: <jg3se3$seo$<a href="mailto:1@dough.gmane.org">1@dough.gmane.org</a>><br>
Content-Type: text/plain; charset="ISO-8859-1"<br>
<br>
George Nyoro wrote:<br>
<br>
> Last time I tried to post a question regarding this, I was asked to<br>
> clarify. Okay so here it is. There is a class called Table and objects are<br>
> just tables, you know, matrices, holding different types of data. Thing<br>
> is, I want to provide a method where one can delete the object and then if<br>
> the user tries using a variable to access a certain method or attributes,<br>
> he gets an error. Let me give an example;<br>
><br>
> class Table:<br>
> def delete_this(self):<br>
> #code to delete this object or assign it null or None<br>
> pass<br>
><br>
> def do_something(self):<br>
> pass<br>
<br>
> x=Table()<br>
> x.delete_this()<br>
><br>
> #at this point, I want such that if I try to use x I get some sort of<br>
> #error<br>
> e.g.<br>
><br>
> x.do_something()<br>
><br>
> #Error: x is definitely not an object anymore<br>
><br>
><br>
> All clear?<br>
<br>
<br>
>>> class Parrot:<br>
... def hello(self):<br>
... print("Hello")<br>
... def delete_this(self):<br>
... self.__class__ = DeadParrot<br>
...<br>
>>> class DeadParrot:<br>
... def __getattr__(self, name):<br>
... raise Exception("This parrot is no more")<br>
...<br>
>>> p = Parrot()<br>
>>> p.hello()<br>
Hello<br>
>>> p.delete_this()<br>
>>> p.hello()<br>
Traceback (most recent call last):<br>
File "<stdin>", line 1, in <module><br>
File "<stdin>", line 3, in __getattr__<br>
Exception: This parrot is no more<br>
<br>
But I don't think it's a good idea...<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sun, 29 Jan 2012 18:05:59 +0000<br>
From: Alan Gauld <<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>><br>
To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Subject: Re: [Tutor] Deleting an object<br>
Message-ID: <jg41q7$6lq$<a href="mailto:1@dough.gmane.org">1@dough.gmane.org</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
On 29/01/12 15:14, George Nyoro wrote:<br>
<br>
> data. Thing is, I want to provide a method where one can delete the<br>
> object and then if the user tries using a variable to access a certain<br>
> method or attributes, he gets an error. Let me give an example;<br>
<br>
I assume you know about the built in del() function that deletes<br>
objects? It works on any kind of object.<br>
<br>
If you need it to do sometjing fancy(like releasing resources say) you<br>
can define your own __del__() method that gets called by Python when the<br>
object is deleted - but you rarely need to do that in Python.<br>
<br>
> class Table:<br>
> def delete_this(self):<br>
> def do_something(self):<br>
<br>
> x=Table()<br>
> x.delete_this()<br>
> #at this point, I want such that if I try to use x I get some sort of<br>
> error e.g.<br>
<br>
x = Table()<br>
del(x)<br>
<br>
now referencing x or any attribute or method will give a name error.<br>
Here is an example using an int, but any kind of object works:<br>
<br>
>>> x = 42<br>
>>> x<br>
42<br>
>>> del(x)<br>
>>> x<br>
Traceback (most recent call last):<br>
File "<stdin>", line 1, in <module><br>
NameError: name 'x' is not defined<br>
>>><br>
<br>
If thats not what you want you need to come vback and explain what is<br>
different about your scenario.<br>
<br>
--<br>
Alan G<br>
Author of the Learn to Program web site<br>
<a href="http://www.alan-g.me.uk/" target="_blank">http://www.alan-g.me.uk/</a><br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Sun, 29 Jan 2012 21:01:47 +0100<br>
From: Navneet <<a href="mailto:rocklearnpython@gmail.com">rocklearnpython@gmail.com</a>><br>
To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Subject: Re: [Tutor] Socket Programming<br>
Message-ID: <<a href="mailto:4F25A5AB.5070903@gmail.com">4F25A5AB.5070903@gmail.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
On 1/27/2012 10:13 PM, Steven D'Aprano wrote:<br>
> Navneet wrote:<br>
><br>
>> One more thing I want to add here is, I am trying to create the GUI<br>
>> based chat server.(Attached the programs.)<br>
><br>
><br>
> Please do not send large chunks of code like this, unless asked.<br>
> Instead, you should try to produce a minimal example that demonstrates<br>
> the problem. It should be:<br>
><br>
> * short (avoid code which has nothing to do with the problem)<br>
><br>
> * self-contained (other people must be able to run it)<br>
><br>
> * correct (it must actually fail in the way you say it fails)<br>
><br>
> See here for more: <a href="http://sscce.org/" target="_blank">http://sscce.org/</a><br>
><br>
><br>
> In cutting your code down to a minimal example, 9 times out of 10 you<br>
> will solve your problem yourself, and learn something in the process.<br>
><br>
><br>
>> bash-3.1$ python Client1.py<br>
>> Enter the server address:...9009<br>
>> Traceback (most recent call last):<br>
>> File "Client1.py", line 53, in <module><br>
>> c = ClientChat(serverport)<br>
>> File "Client1.py", line 24, in __init__<br>
>> gui.callGui()<br>
>> File "a:\FedEx\Exp\ClientGui.py", line 37, in callGui<br>
>> sendbutton =Button(f2, width = 5, height = 2, text = "Send",<br>
>> command = C.ClientChat.senddata())<br>
>> TypeError: unbound method senddata() must be called with ClientChat<br>
>> instance as first argument (got nothing instead)<br>
><br>
><br>
> This one is easy. You need to initialize a ClientChat instance first.<br>
> This may be as simple as:<br>
><br>
> command = C.ClientChat().senddata<br>
><br>
> although I'm not sure if ClientChat requires any arguments.<br>
><br>
> Note that you call the ClientChat class, to create an instance, but<br>
> you DON'T call the senddata method, since you want to pass the method<br>
> itself as a callback function. The button will call it for you, when<br>
> needed.<br>
><br>
><br>
><br>
Thanks for the clarification and telling me about SSCCE :)<br>
<br>
But just a simple thing,,, Can I call a method of another module while<br>
creating a GUI.<br>
<br>
For example<br>
C = Tk()<br>
.....(Some more lines)<br>
self.sendbutton =Button(self.f2, width = 5, height = 2, text = "Send",<br>
command = <ANOTHER MODULE>.<METHOD OF THAT MODULE>)<br>
self.sendbutton.pack(side = LEFT, padx = 10, pady = 10)<br>
.....(Some more lines)<br>
C.mainloop()<br>
<br>
<br>
Because I am getting stuck in a loop. The client is keep on connecting<br>
to server without creating a GUI.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Mon, 30 Jan 2012 00:28:21 +0200<br>
From: amt <<a href="mailto:0101amt@gmail.com">0101amt@gmail.com</a>><br>
To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Subject: Re: [Tutor] Why do you have to close files?<br>
Message-ID:<br>
<CAEQEn016afJDN+2F_+R-rm2d4MbWGXvN9_ed-AQoNmT=<a href="mailto:F2VKiQ@mail.gmail.com">F2VKiQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
All the replies were very helpful! Thank you very much for helping me out!<br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Mon, 30 Jan 2012 10:50:51 +0530<br>
From: Surya K <<a href="mailto:suryak@live.com">suryak@live.com</a>><br>
To: Python Tutor <<a href="mailto:tutor@python.org">tutor@python.org</a>><br>
Subject: [Tutor] loop until a keypress<br>
Message-ID: <SNT130-W397E068F9E47ABD82EEA34A48D0@phx.gbl><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
<br>
I want to run code until a "enter" is pressed. Well, it shouldn't wait for the user to enter "enter"<br>
This is my code:<br>
import msvcrtchr = 0while chr != 'q': print "my code", if msvcrt.kbhit(): chr = msvcrt.getch()<br>
This isn't working the way I wanted. When ever I press enter, the loop is starting in a new line and continuing.<br>
I even added "break" statement in "if" block but it isn't workingCan you tell me how to do that?<br>
I am on windows. So, as msvcrt is for windows, I wonder if there is any module that works for both,<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/tutor/attachments/20120130/a5996b2a/attachment-0001.html" target="_blank">http://mail.python.org/pipermail/tutor/attachments/20120130/a5996b2a/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 6<br>
Date: Mon, 30 Jan 2012 11:55:12 +0530<br>
From: Ganesh Kumar <<a href="mailto:bugcy013@gmail.com">bugcy013@gmail.com</a>><br>
To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Subject: [Tutor] Help Glade Tutorial.<br>
Message-ID:<br>
<<a href="mailto:CAJzooYc-OaR6JOz9WRJBtv0W6t3L2ZL0dZV%2BGUyD-yUP9xe-JQ@mail.gmail.com">CAJzooYc-OaR6JOz9WRJBtv0W6t3L2ZL0dZV+GUyD-yUP9xe-JQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Guys,<br>
<br>
I am searching for a Glade tutorial, on how to create simple projects Glade<br>
with python<br>
<br>
1) design a simple interface in glade<br>
2) use the glade interface to write some really simple application with<br>
python.<br>
<br>
I search in goggled i didn't get good tutorials, guide me guys How to start<br>
with Glade.<br>
<br>
-Ganesh<br>
<br>
Did I learn something today? If not, I wasted it.<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/tutor/attachments/20120130/fec2e0a2/attachment-0001.html" target="_blank">http://mail.python.org/pipermail/tutor/attachments/20120130/fec2e0a2/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 7<br>
Date: Mon, 30 Jan 2012 00:51:58 -0600<br>
From: Chris Fuller <<a href="mailto:cfuller084@thinkingplanet.net">cfuller084@thinkingplanet.net</a>><br>
To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Subject: Re: [Tutor] Help Glade Tutorial.<br>
Message-ID: <<a href="mailto:201201300051.58828.cfuller084@thinkingplanet.net">201201300051.58828.cfuller084@thinkingplanet.net</a>><br>
Content-Type: Text/Plain; charset="utf-8"<br>
<br>
<br>
Which ones did you look at, and why did you not like them? Keep in mind that<br>
Glade is an interface builder, and hasn't got anything much to do with the<br>
target language, other than requiring there be a libglade library to read the<br>
XML files.<br>
<br>
I actually got started with some articles in Linux Journal, which don't appear<br>
high on the google search unless you include those terms. Search for "glade<br>
tutorial" or "glade linux journal". Leave Python or pyGTK out of your search<br>
for now.<br>
<br>
You might need a little help with using the XML files glade produces, but<br>
that's covered in the pyGTK documentation. It's also in the Linux Journal<br>
articles. You can google "pygtk glade" if you need more.<br>
<br>
Cheers<br>
<br>
On Monday 30 January 2012, Ganesh Kumar wrote:<br>
> Hi Guys,<br>
><br>
> I am searching for a Glade tutorial, on how to create simple projects Glade<br>
> with python<br>
><br>
> 1) design a simple interface in glade<br>
> 2) use the glade interface to write some really simple application with<br>
> python.<br>
><br>
> I search in goggled i didn't get good tutorials, guide me guys How to start<br>
> with Glade.<br>
><br>
> -Ganesh<br>
><br>
> Did I learn something today? If not, I wasted it.<br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
<br>
<br>
End of Tutor Digest, Vol 95, Issue 80<br>
*************************************<br>
</blockquote></div><br><br clear="all"><br>-- <br>Thanks & Regards,<br><br>Arun Kumar<br><a href="http://clicknscroll.blogspot.com" target="_blank">http://clicknscroll.blogspot.com</a><br><br><br><br>