<rss version="2.0">
		<channel>
			<title>LearningPython Forums - PyGTK</title>
			<lastBuildDate>Wed, 22 May 2013 14:43:14 -0400</lastBuildDate>
			<link>http://www.learningpython.com/forums/</link>
			<description></description>
			<generator>Lussumo Vanilla 1.1.10</generator>
			<item>
		<title>None</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=36</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=36</guid>
		<pubDate>Fri, 09 Apr 2010 04:04:38 -0400</pubDate>
		<author>ivan.ivanenko</author>
		<description>
			<![CDATA[None]]>
		</description>
	</item>
	<item>
		<title>gtk.combo problem</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=26</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=26</guid>
		<pubDate>Thu, 25 Oct 2007 01:56:44 -0400</pubDate>
		<author>rhitam30111985</author>
		<description>
			<![CDATA[Hi all.. i am trying to create a combo with the pop down list being modfied in real time as i type each character :<br /><br />&lt;code&gt;import gtk<br />window=gtk.Window(gtk.WINDOW_TOPLEVEL)<br />window.connect(&quot;destroy&quot;,gtk.main_quit)<br />combo=gtk.Combo()<br />combo.set_use_arrows(True)<br /><br />wordlist=['aata','abbay','acute','adistance','bobbby','cat','cbount','daddy']<br />def entry_callback(widget,combo):<br /># ------<br /><br />combo.entry.connect(&quot;activate&quot;,entry_callback,combo)<br />window.add(combo)<br />window.show()<br />combo.show()<br />gtk.main()   <br />&lt;/code&gt;<br /><br />now my aim is when i enter a chareacter 'a' into the combo.entry field .. all the words beginning with the letter 'a'  wud be set in the popdown list .. if the next character is 'c' , meaning now the entry is 'ac' then the pop down list should be modified to only the word 'acute' .. now the problem is the combo.entry.get_text() function will return a string only when the enter key is pressed .. how do i set the pop down list without pressing the enter key ?  :(    assuming i already haev a function which is  a python version of the C function getch() . returning the character which is pressed on the keyboard .. here is the fucntion:<br /><br /><br /><br />&lt;code&gt;<br />def getch():<br />	import os, tty<br /><br />	fd = sys.stdin.fileno()<br />	tty_mode = tty.tcgetattr(fd)<br />	tty.setcbreak(fd)<br />	try:<br />	        ch = os.read(fd, 1)<br />	finally:<br />	        tty.tcsetattr(fd, tty.TCSAFLUSH, tty_mode)<br /><br />	return ch<br /><br />&lt;/code&gt;<br />but this wud catch a chaarcter entered in the console .. how do i do the same for the entry box of the combo.. any help appreciated.<br />regards]]>
		</description>
	</item>
	<item>
		<title>How to set combobox ListStore depending on another combobox selection.</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=39</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=39</guid>
		<pubDate>Tue, 12 Apr 2011 10:00:14 -0400</pubDate>
		<author>antonucci</author>
		<description>
			<![CDATA[I'm writing a gui and need to show two comboboxes in wich the second ListStore should be set according to the first combobox selection. <br />Anyone could help me?<br /><br />Here is my code:<br /><br />#programa cnec.py<br />#teste via pygtk<br /><br />import pygtk<br />pygtk.require('2.0')<br />import gtk<br />import glade<br />import MySQLdb<br /><br />class cnec:<br />	def arquivo(self):<br />		self.xml = gtk.glade.XML('teste.glade')<br />		<br /><br />	def delete(self, widget, event, data=None):<br />		print "delete acionado"<br />		return False<br />		<br />	def destroy(self, widget, data=None):<br />		print "destruido"<br />		gtk.main_quit()<br /><br />	def get_active_text(combobox):<br />		model = combobox.get_model()<br />		active = combobox.get_active()<br />		if active &lt; 0:<br />			return None<br />		return model[active][0]<br /><br />	def changed_cb(combobox, widget, data=None):     <br />		sele=widget.get_active()<br />		return sele<br /><br /><br /><br />	def __init__(self):<br />		self.arquivo()<br />		<br />		#definicao das consultas<br />		con = MySQLdb.connect(host="localhost", port=3000, user="root", passwd="root", db="codificacao")<br />		cur = con.cursor()<br />		<br />		#criacao da janela principal<br />		self.janela=self.xml.get_widget('window1')<br />		<br />		#conecao de sinais da janela<br />		self.janela.connect("destroy", self.destroy)<br />		self.janela.connect("delete_event", self.delete)<br />		<br />		#criacao das listas<br />		self.lista1=gtk.ListStore(str)<br />		self.lista2=gtk.ListStore(str)<br />		self.lista3=gtk.ListStore(str)<br />		self.lista4=gtk.ListStore(str)<br />		self.lista5=gtk.ListStore(str)<br />		self.lista6=gtk.ListStore(str)<br />		self.lista7=gtk.ListStore(str)<br />		self.lista8=gtk.ListStore(str)<br />		self.lista9=gtk.ListStore(str)<br />		self.lista10=gtk.ListStore(str)<br />		self.lista11=gtk.ListStore(str)<br />		<br />		cell = gtk.CellRendererText()<br />		<br />		#criacao dos botoes<br />		self.botao1 = self.xml.get_widget('combobox1')<br />		self.botao2 = self.xml.get_widget('combobox2')<br />		self.botao3 = self.xml.get_widget('combobox3')<br />		self.botao4 = self.xml.get_widget('combobox4')<br />		self.botao5 = self.xml.get_widget('combobox5')<br />		self.botao6 = self.xml.get_widget('combobox6')<br />		self.botao7 = self.xml.get_widget('combobox7')<br />		self.botao8 = self.xml.get_widget('combobox8')<br />		self.botao9 = self.xml.get_widget('combobox9')<br />		self.botao10 = self.xml.get_widget('combobox10')<br />		self.botao11 = self.xml.get_widget('combobox11')<br />		self.sair = self.xml.get_widget('button3')<br />		<br />		#preencher lista1<br />		sql1='select ID from codificacao.componentes'<br />		cur.execute(sql1)<br />		rs1=cur.fetchall()<br />		<br />		self.lista1<br />		for dados in rs1:<br />			self.lista1.append(dados)<br />			<br />		#preencher botoes<br />		self.botao1.set_model(self.lista1)<br />		self.botao1.pack_start(cell, True)<br /><br />		#preencher lista 2<br />		<br />		<br />		if self.botao1.get_active() == 'C':<br />			sql2='select d2 from codificacao.conexao'<br />			cur.execute(sql2)<br />			rs2=cur.fetchall()<br />			<br />			self.lista2<br />			for dados in rs2:<br />				self.lista2.append(dados)<br /><br />		self.botao2.set_model(self.lista2)	<br />		self.botao2.pack_start(cell, True)<br />		<br />		self.sair.connect_object("clicked", gtk.Widget.destroy, self.janela)<br />		self.botao1.connect("changed", self.changed_cb)<br /><br />		#mostra a interface<br />		self.xml.signal_autoconnect(self)<br />		self.janela.show_all()<br />		<br /><br />		<br />	def main(self):<br />		gtk.main()<br />		<br />if __name__ == "__main__":<br />	cnec = cnec()<br />	cnec.main()]]>
		</description>
	</item>
	<item>
		<title>Problems with a gtk.TextView</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=16</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=16</guid>
		<pubDate>Tue, 13 Feb 2007 10:56:20 -0500</pubDate>
		<author>selsine</author>
		<description>
			<![CDATA[Post made by <strong >apurva</strong><br /><br />hey,<br />i really appreciate the efforts that you are making to make life simpler for absolute noobs like me<br />i am trying to develop a spam filter and for demo purposes, simulating a mail viewer too(in glade+pygtk)<br /><br />Now, im getting stuck at a very trivial place.<br />I display a particular mail in a TextView... but if i choose another mail, it is getting appended placed at the cursor position(since i use insert_at_cursor for the textbuffer), but actually, the previous mail should be cleared first, and then this 1 should be displayed.<br />i set_overwrite(True) for the TextView object before printing, yet, the textview is not cleared.<br />where am i going wrong??]]>
		</description>
	</item>
	<item>
		<title>Manipulating Style of widgets</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=25</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=25</guid>
		<pubDate>Wed, 19 Sep 2007 05:19:20 -0400</pubDate>
		<author>kdikert</author>
		<description>
			<![CDATA[Hi,<br /><br />I am developing an application that will run on a PDA and it requires some special layouts and looks for the widgets. The PDA has a touch sensitive screen and the application is used by pressing on the display with the finger tips. Because of this I need to make some UI elements really big so that they are easy to click on. I also need to make some customization on the default widgets in order to create an optimal UI. In order to save effort I want the widgets to lay out and respond to interaction in the default way, but I want to entirely control the drawing of the widgets in each of their states. I want to write the entire application in Python. I found many good examples on this page, but I still need some more information. I have the following problems:<br /><br />- I want to make a vertical scrollbar 40 pixels wide, so that it is easy to use with the finger tips. I find an attribute named &quot;slider-width&quot; listed in gtk.Range Style Properties in the GTK class reference. However, in the API reference I find no clue whatsoever on how to manipulate that value, or even in which construct it is stored in or how to read it. I need to know 1) how I can read the &quot;slider-width&quot; property of a gtk.VScrollbar and 2) how can I change the value.<br /><br />- There is a class called gtk.Style which I presume controlls the drawing of all basic widgets in a nice and efficient way. However, the PDA implementation of gtk.Style.paint_box() will draw only the right and bottom edges of the box. I would like to create my own Style implementation that would correct the problem, and also bring some additional visuality to the basic box. Is it possible to create such an own style? If I create a new own style it must inherit all attributes (such as colors) from the current default style. How do I implement the inheritance of the attributes?<br /><br />- If I use my own gtk.Style instance, is there any way to set it as the default style in the application initialization? All widgets that would be created afterwards would then use the recently assigned new default style.<br /><br />Thanks in advance!]]>
		</description>
	</item>
	<item>
		<title>Cocos2d + PyGTK?</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=33</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=33</guid>
		<pubDate>Sat, 13 Jun 2009 04:35:18 -0400</pubDate>
		<author>mots</author>
		<description>
			<![CDATA[Hey, as you've written dodger (which embeds pyglet in pygtk) and cocos2d is built on pyglet, I hope you might help me... I want to build a game using pygtk for the UI and cocos2d for the rendering... But how do I embed a cocos2d director (which is a pyglet.window.window, I think) into a pygtk application?<br /><br />This is the most simple cocos2d app I can write:<br /><code >import cocos<br />class HelloWorld(cocos.layer.Layer):<br />    def __init__(self):<br />        super( HelloWorld, self ).__init__()<br />        label = cocos.text.Label('Hello, world',<br />                          font_name='Times New Roman',<br />                          font_size=32,<br />                          anchor_x='center', anchor_y='center')<br />        label.position = 320,240<br />        self.add( label )<br />     <br />cocos.director.director.init()<br />hello_layer = HelloWorld ()<br />main_scene = cocos.scene.Scene (hello_layer)<br />cocos.director.director.run (main_scene)<br /></code><br /><br />So how would I embed this director in a pygtk window? Any ideas?]]>
		</description>
	</item>
	<item>
		<title>Change objects in a gtk.table</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=21</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=21</guid>
		<pubDate>Sat, 05 May 2007 12:48:27 -0400</pubDate>
		<author>hpl</author>
		<description>
			<![CDATA[Hello everybody!<br />This is my first Post on this forum... before explaining my problem, I wanna thank Selsine for his blog!<br /><br />Here are my problem with the pyGtk library:<br /><br />I have made a table for my window... table = gtk.Table(ROWS, COLS)<br />and I have attached into a table-cell an image...<br />img = gtk.Image()<br />img.set_from_file(&quot;image.jpg&quot;)<br />table.attach(img, x, x1, y, y1)<br />and this is ok... <br /><br />Now I want to change this image on the table-cell by a callback function (e.g. clicked button...)<br /><br />I have tried to find solution on the documentation and google... but I have been unable to solve.<br /><br />What I have to do? <br />Do you have another idea about change an image in the window by a callback function?<br /><br />Thanks!<br />^__^]]>
		</description>
	</item>
	<item>
		<title>Passing extra information to signal handlers</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=17</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=17</guid>
		<pubDate>Thu, 15 Feb 2007 10:08:05 -0500</pubDate>
		<author>selsine</author>
		<description>
			<![CDATA[The other day I got the following comment from foxmjay posted on my <a href="http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/" >Creating a GUI using PyGTK and Glade</a> tutorial:<br /><br /><blockquote >hi<br />thank you for this tutorial, i just started learning pygtk but it take much time to make GUI with gtk directly in code so i searched for something like qt-designer and here i found this nice tutorial :) .but i have a question how to call a function with arguments when the button is pressed , i mean i want to call this function :<br /><br />def btnHelloWorld_clicked(self, widget, txt):<br />print “Hello World! %s” % txt<br /><br />so how could i mention the argument txt :<br /><br />dic = { “on_btnHelloWorld_clicked” : self.btnHelloWorld_clicked}<br />self.wTree.signal_autoconnect(dic)<br /><br />thanks </blockquote><br /><br />Thankfully the solution is quite simple since you can specify extra callback data when you connect a signal with its handler (a simple example):<br /><br /><code lang="python" ><br />#!/usr/bin/env python<br /><br />import sys<br />try:<br /> 	import pygtk<br />  	pygtk.require(&quot;2.0&quot;)<br />except:<br />  	pass<br />try:<br />	import gtk<br />  	import gtk.glade<br />except:<br />	sys.exit(1)<br /><br />class simpleData(object):<br /><br />	def __init__(self, text):<br />		self.text = text<br /><br />class HellowWorldGTK:<br />	&quot;&quot;&quot;This is an Hello World GTK application&quot;&quot;&quot;<br />	def __init__(self):<br /><br />		#Set the Glade file<br />		self.gladefile = &quot;pyhelloworld.glade&quot;<br />		self.wTree = gtk.glade.XML(self.gladefile)<br /><br />		#Create our dictionay and connect it<br />		dic = {&quot;on_MainWindow_destroy&quot; : gtk.main_quit }<br />		self.wTree.signal_autoconnect(dic)<br /><br />		button = self.wTree.get_widget(&quot;btnHelloWorld&quot;)<br />		button.connect(&quot;clicked&quot;, self.btnHelloWorld_clicked<br />			, simpleData(&quot;Text&quot;))<br /><br />	def btnHelloWorld_clicked(self, widget, data):<br />		print &quot;Hello World: &quot;, data.text<br />		data.text = &quot;New Text&quot;<br /><br />if __name__ == &quot;__main__&quot;:<br />	hwg = HellowWorldGTK()<br />	gtk.main()<br /></code><br /><br />The results from running this and clicking the button twice are:<br /><br /><code ><br />Hello World: Text<br />Hello World: New Text<br /></code><br /><br />So I decided to post this information here just in case anyone else has a similar question, or knows of a better way to do this.  Generally I would probably just add a member to the class that contains this information but perhaps there are some obvious reasons when doing this would be very useful, and I'm just missing them.<br /><br />selsine.]]>
		</description>
	</item>
	<item>
		<title>classes and libglade with &quot;large&quot; applications</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=6</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=6</guid>
		<pubDate>Thu, 18 Jan 2007 16:48:31 -0500</pubDate>
		<author>greg</author>
		<description>
			<![CDATA[The pygtk tutorials seem to use a single class per window or dialog and then signal_autoconnect(dict) to wire up the signals with the handlers, which are methods.  What is normally done with larger applications?  For instance if I have a main window with a menu, a few treeviews, and an area for plotting a graph should I just make a lot of methods to a single application class or should I partition the handler methods among different classes (like for each listview, the graph, etc.).  In reality, the methods just become function pointers than are passed to signal_autoconnect, so I'm not sure it matters, but what is the &quot;usual&quot; convention?]]>
		</description>
	</item>
	<item>
		<title>zoom and pan in pygtk</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=34</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=34</guid>
		<pubDate>Thu, 18 Jun 2009 16:45:43 -0400</pubDate>
		<author>mak89</author>
		<description>
			<![CDATA[hello all,<br /><br />I am trying to make some map interaction app in which I need to log zooming and panning actions, I have a problem implementing the zoomin, zoomout and pan action using pygtk. I have also tried pygame, but integrating it to pygtk is also a problem. Could someone please come to my recsue on  this, implementing the zooming and panning actions? Thanks in advance<br /><br />Mak89]]>
		</description>
	</item>
	<item>
		<title>simple textview problem</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=27</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=27</guid>
		<pubDate>Tue, 30 Oct 2007 15:12:41 -0400</pubDate>
		<author>squeakyfrommage</author>
		<description>
			<![CDATA[I'm trying to view a plaintext file in my gui (the textfile is the output of a seperate program).  I can't seem to figure out how to do this at all.  If anyone could explain it to me, or tell me where to look, I'd really appreciate it.  Thanks.]]>
		</description>
	</item>
	<item>
		<title>redesigning the &quot;smart package manager&quot; gui</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=31</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=31</guid>
		<pubDate>Sun, 06 Jul 2008 19:46:06 -0400</pubDate>
		<author>Jonathan R</author>
		<description>
			<![CDATA[I started redesigning the "smart package manager" gui sometime ago. I used glade for the gui, now I'm trying to write the python end. <br /><br />My python code is here <a href="http://downloads.thecompletecomputerresource.com/smart/smart%20gui/smartgui2.py" >http://downloads.thecompletecomputerresource.com/smart/smart%20gui/smartgui2.py</a> and my glade code is here <a href="http://downloads.thecompletecomputerresource.com/smart/smart%20gui/smartgui2-20080705.glade" >http://downloads.thecompletecomputerresource.com/smart/smart%20gui/smartgui2-20080705.glade</a><br /><br />Now I'm stuck on what to do next. self.wTree.signal_autoconnect (dic) doesn't seem right. After window1 in my glade file comes menubar. So I'm not sure what I should do. <br /><br />I'm not asking someone to write it for me, just some direction as to what to do next.]]>
		</description>
	</item>
	<item>
		<title>Destroy window and show it again</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=38</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=38</guid>
		<pubDate>Thu, 03 Mar 2011 10:35:49 -0500</pubDate>
		<author>faidoc</author>
		<description>
			<![CDATA[I have a big problem. I don' t understand the way of destroing a windows when the user clicks on the "x" and then could show that windows in the future. By the moment I use a "Close" button that hides the window and to show just "show_all()". How could I solve this? <br /><br />This is exactly what I do:<br /><br /><code >class icon:<br />   def __init__(self):<br />      builder = gtk.Builder()<br />      if OS != &quot;win32&quot;:<br />        builder.add_from_file(&quot;resanator-gui.glade&quot;)<br />      else:<br />        os.chdir(&quot;C:\\resanator&quot;)<br />        builder.add_from_file(&quot;resanator-gui.glade&quot;)<br />      self.tray = builder.get_object(&quot;tray&quot;)<br />      self.menu = builder.get_object(&quot;menu&quot;)<br />      self.about_dialog = builder.get_object(&quot;abou_dialog&quot;)<br />      self.options = builder.get_object(&quot;options&quot;)<br />      self.user_in = builder.get_object(&quot;user_in&quot;)<br />      self.pass_in = builder.get_object(&quot;pass_in&quot;)<br />      self.save_data = builder.get_object(&quot;save_data&quot;)<br />      self.lunch = builder.get_object(&quot;lunch&quot;)<br />      self.vista = builder.get_object(&quot;vista&quot;)<br />      self.close_lunch = builder.get_object(&quot;close_lunch&quot;)<br />	<br /><br />      builder.connect_signals(self)</code><br /><br />That is the __init__ function<br /><br />Then, for when the user clicks the "Close" button:<br /><br /><br /> <code >  def on_close_about_clicked(self, widget, data=None):<br />	  self.about_dialog.hide() </code><br /><br />To activate that windows I got:<br /><br /><code >def on_tray_activate(self, widget, data=None):<br />      self.about_dialog.show_all()</code><br /><br />And then... :<br /><br /><code >if __name__ == &quot;__main__&quot;:  <br />	icon()<br />	gtk.main()</code><br /><br />The program is just an icon in the tray system. When the user clicks with the left button of the mouse it shows the "About Dialog"<br /><br />I got this problem with every window I make -.- so... it is a big problem<br /><br />Thanks]]>
		</description>
	</item>
	<item>
		<title>New style for Glade-3.20</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=22</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=22</guid>
		<pubDate>Tue, 22 May 2007 21:49:10 -0400</pubDate>
		<author>mbastien</author>
		<description>
			<![CDATA[I don't know about other people but I'm not a fan of the separate window applications like the way Glade used to be.  But now with version 3.2x it's more like traditional programs, along the lines of Visual Studio or QTsDesigner.<br /><br />Who else likes it this way?<br />http://glade.gnome.org/]]>
		</description>
	</item>
	<item>
		<title>RAD GUI Programming with Glade and smartglade</title>
		<link>http://www.learningpython.com/forums/comments.php?DiscussionID=29</link>
		<guid isPermaLink="false">http://www.learningpython.com/forums/comments.php?DiscussionID=29</guid>
		<pubDate>Fri, 09 Nov 2007 07:09:56 -0500</pubDate>
		<author>pyrgen</author>
		<description>
			<![CDATA[Hi,<br />I came out with an interesting way to build GTK+ based applications using Python programming language, Glade GUI builder and <strong >smartglade</strong> module on almost all modern platforms. Inspired by libglade, it brings a fresh way how to deal with widget identifiers in programs. It smartly fixes their names and initialize. smartglade allows dynamic loading of user interfaces from XML descriptions (Glade files or buffers). smartglade automatically creates (gets children, assigns identifiers and initialize them) corresponding widgets from XML descriptions. smartglade uses following Python modules: pygtk, gtk, gobject and xml.<br /><br />If anyone is interested in developing this module and keeping it very very simple and lightweight, you can find me here: <a href="http://pyrgen.googlepages.com/" >http://pyrgen.googlepages.com/</a><br /><br />See also:<br /><a href="http://pyrgen.googlepages.com/smartglade" >http://pyrgen.googlepages.com/smartglade</a><br /><br />Project page:<br /><a href="http://code.google.com/p/smartglade/" >http://code.google.com/p/smartglade/</a>]]>
		</description>
	</item>
	
		</channel>
	</rss>