LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2011, 09:54 AM   #1
apanimesh061
Member
 
Registered: Sep 2010
Posts: 51

Rep: Reputation: 0
Exclamation Problem in using Glade to make GUI !


I made an FTP server-client in C.
I connected them using GUI made in glade !

I want to know how to use text entered in a text box as a command line argument.

This the code for Client.glade
Code:
#!/usr/bin/env python
"""client.pyw"""
import os
import sys
try:
 	import pygtk
  	pygtk.require("2.0")
except:
  	pass
try:
	import gtk
  	import gtk.glade
except:
	sys.exit(1)

class HellowWorldGTK:

	def __init__(self):
		
		#Set the Glade file
		self.gladefile = "Client.glade"  
	        self.wTree = gtk.glade.XML(self.gladefile) 
		
		#Create our dictionay and connect it 
		dic = { 
                    "on_btnHelloWorld_clicked" :  self.btnHelloWorld_clicked,
	            "on_MainWindow_destroy" : gtk.main_quit 
                }
		self.wTree.signal_autoconnect(dic)

		dic = { 
                    "on_btnHelloWorld1_clicked" :  self.btnHelloWorld1_clicked,
		    "on_MainWindow_destroy" :  gtk.main_quit 
                }
		self.wTree.signal_autoconnect(dic)


        def btnHelloWorld1_clicked(self, widget):
		os.system('clear && gcc -o c ftpcli.c && ./c <Server IP Address>')
        def btnHelloWorld_clicked(self, widget):
		sys.exit(1)


if __name__ == "__main__":
	hwg = HellowWorldGTK()
	gtk.main()
I have attached a snap shot for your convenience.
The buttons work correctly.
I just want the IP address to be entered in the box and it be used as in the bold portion in the code above !

Please help !
Thanx !
Attached Thumbnails
Click image for larger version

Name:	Client.jpg
Views:	20
Size:	108.4 KB
ID:	8557  
 
Old 12-05-2011, 01:02 PM   #2
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi.

You've forgot to post "Client.glade" file? Look at this tutorial, especially at the `run' function (search for "def run"). You probably should do something like this:
Code:
widget = self.wTree.get_widget("widget-name")
IP = widget.get_text()
os.system('clear && gcc -o c ftpcli.c && ./c ' + IP)
You should also check that IP contains a valid IP address.

Hope this helps.
 
Old 02-19-2012, 12:36 PM   #3
sweet_champion
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
Hey, I am a newbie and I am using glade on windows. So can you please redirect me to the correct forum for posting my problems and queries.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing .pl file in the konsole through Glade GUI shandy^^^ Programming 4 09-25-2006 03:42 PM
Translations of GUI created with Glade, Python vimico Programming 1 12-22-2005 02:36 PM
glade generate c gui - how? abs Programming 0 04-06-2004 02:17 PM
Creating a GUI without QI, Glade, etc mymojo Programming 4 10-20-2003 11:32 PM
GUI>>glade i want to install C++ compiler amr_azima Linux - Software 1 03-21-2002 02:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration