[Glade-users] noobie question.
- From: russ at mannex.com (Russ Mannex)
- Subject: [Glade-users] noobie question.
- Date: Sun, 26 Dec 2010 18:02:47 -0800
Have you tried gtk_entry_get_text? Make sure the field connected first
with something like:
entry = GTK_ENTRY( gtk_builder_get_object( builder, "entry1" ) );
Hope that helps.
--
Mannex
On Mon, 2010-12-27 at 00:24 +0400, Rajesh Sharma wrote:
I am trying to build a simple password challenge window.
I have been unable to extract the text from the gtkentry box.
I would think. I would have to use get_text() but .. unable to do so..
any help is apprciated.
Been trying to acces gtkforums.com for the last two days.. but its
down.
codes..
-----------------------------------.py--------------------
import sys
import os
import gtk
#import gtk.glade
import random
import pango
class merchantPOS:
def on_window_destroy(self, widget, data=None):
gtk.main_quit()
# Manage the Password Windows here Three function ... Two to exit
# And Another one to check for password Three Time and pass
control OR Exit.
def on_password_destroy(self, widget, data=None):
gtk.main_quit()
def on_passwordcancel_clicked(self, widget, data=None):
gtk.main_quit()
def on_passok_clicked(self,widget, data=None):
uid=self.builder.get_object('useriden')
useridtext=self.useriden.get_text()
useriid=int(useridtext);
def on_userid_editing_done(self, widget, data=None):
gtk.main_quit()
# Just testing Destroy after use.
def on_test_clicked(self, widget, data=None):
self.test.set_text('Yay! It printed')
# Start The processing of the main Window here
def __init__(self):
builder = gtk.Builder()
builder.add_from_file("merchantpassword.glade")
self.window = builder.get_object("passwindow")
builder.connect_signals(self)
self.window.show()
if __name__ == "__main__":
merchant = merchantPOS()
merchant.window.show()
gtk.main()
----------------------------------------------------------------------------
-----------------------------------------*.glade-------------------------
?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.20"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="passwindow">
<property name="tooltip_text" translatable="yes">Please Enter Your
User ID Here</property>
<property name="title" translatable="yes">Login</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<child>
<object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="label" translatable="yes">User
ID</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkEntry" id="useriden">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="invisible_char">?</property>
<property name="shadow_type">etched-in</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="label"
translatable="yes">Password</property>
<property name="ellipsize">start</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkEntry" id="passwd">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">?</property>
<property name="shadow_type">etched-in</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="passok">
<property name="label"
translatable="yes">Submit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property
name="use_action_appearance">False</property>
<signal name="clicked" handler="on_passok_clicked"
swapped="no"/>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="passwordcancel">
<property name="label"
translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property
name="use_action_appearance">False</property>
<signal name="clicked"
handler="on_passwordcancel_clicked" swapped="no"/>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="label" translatable="yes">Please Enter
Your Username and password to proceed</property>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
---------------------------------------------------------------------------------
i've been coding in php for a long tiem.. now. AND i'm kind new to
oops. :)
been using c also for a long time but.. I could never work with c++
but teaching myself now.
rgds
--
Design --- Develop --- Deploy
_______________________________________________
Glade-users maillist - Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20101226/68c70a50/attachment.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]