Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Anthony Papillion
On Fri, Feb 24, 2012 at 8:08 PM, Steven D'Aprano wrote: > > Are you aware that the database connection gets made, but not stored > anywhere? Once the Manager instance is created, the database connection is > thrown away. > > My guess is that you mean to use self.conn instead of conn in the above.

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Steven D'Aprano
Anthony Papillion wrote: class Manager(object): def __init__(self): builder = gtk.Builder() builder.add_from_file("winMain.glade") builder.connect_signals(self) self.window = builder.get_object("winMain") self.window.show() conn = None

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Alan Gauld
On 25/02/12 00:17, Anthony Papillion wrote: The entire GUI is created using Glade. In Glade, I've clicked on the button widget and then the Signals tab. I'm associating the btnSearch's click event with the on_btnSearch.clicked method. As I said above, the method is being called, I'm just not abl

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Anthony Papillion
On Fri, Feb 24, 2012 at 5:55 PM, Prasad, Ramit wrote: > > How are you running this? I assume from an IDE because this should most > likely cause an error. I would recommend trying to run your python script > from the commandline which is much more likely to print an error. > > $python your_script.

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Anthony Papillion
On Fri, Feb 24, 2012 at 6:07 PM, Alan Gauld wrote: > > Add a trace to see if the method ever gets called The method is definitely getting called. If I remove the attempt to get the widgets text and replace it with print "btnSearch has been clicked" The method is called and the message is printe

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Prasad, Ramit
>def on_btnSearch_click(self, data=None): >if btnSearch.get_text() == "": >print "Nothing to search" >else: >print "I would do this search" >The code above does nothing. No error, no print, nothing. Any idea? How are you running this? I assume from an IDE because this shou

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Alan Gauld
On 24/02/12 23:49, Anthony Papillion wrote: Add a trace to see if the method ever gets called def on_btnSearch_click(self, data=None): print "I'm in on_btnSearch_click" if btnSearch.get_text() == "": print "Nothing to search" else: print "I would do this s

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Anthony Papillion
On Fri, Feb 24, 2012 at 5:10 PM, Prasad, Ramit wrote: > > Please post a more significant code sample as I have no idea from this, > but at least one of those should have given you an error. Always include > the full error (including stacktrace) you get from Python. Use copy/paste > and do not try

Re: [Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Prasad, Ramit
>if txtSearch.get_text() == "": >    print "The entry is empty" >This didn't work. So I thought, maybe I need to reference self and tried: >if self.txtSearch.get_text() == "": >    print "The entry is empty" >Neither worked. What am I doing wrong? Please post a more significant code sample as I

[Tutor] Checking if a GtkEntry is empty

2012-02-24 Thread Anthony Papillion
Hi Everyone, I'm learning pyGtk and am developing my first application. I'm trying to check if a GtkEntry is empty and I'm using the following code: if txtSearch.get_text() == "": print "The entry is empty" This didn't work. So I thought, maybe I need to reference self and tried: if self.tx