[pygtk] Style problem
Hi I am trying to change the font of a label with the following code: fuente = gtk.load_font("-*-helvetica-*-*-*-*-24-*-*-*-*-*-*-*") strMensaje = string.replace(strMensaje,'\\n','\n') gtkLabel = gtk.GtkLabel(strMensaje) estilo = gtkLabel.get_style() estilo.font = fuente gtkLabel.set_style(estilo) And it works, but no as I expected... the font change for this widgets, but it also changes for all the other ones in the aplication... Is there any other system to change the font of a widget? how can I change the style of a "concret" widget? thanks in advance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia This is my signature. There are many signatures like it but this one is mine.. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] How control the focus?
Hi! I have a VBox with 4 buttons and i want to control the focus. I need to prevent the focus to go to the first button when i have the focus at the last button and the same if the focus is at the fisrt focus and the user press a key to put the focus at the previous button. What signal can i control to control the normal behaivour of the focus??? Thanks in advance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Windows: From the people who brought you EDLIN! ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Button child
El Wed, May 16, 2001 at 03:10:26PM +0200, Eduardo Ferro dijo: > I need to get the label of a button in its signal handler... > now the code that i use is: > > def ioCambiada(gtkButton): > gtkLabel = gtkButton.children() > print gtkLabel > gtkLabel.set_text('Prueba') Forget this message... I don`t know that the .children return a list so i have a list with a gtkLabel, but not the gtkLabel So the code must be like: def ioCambiada(gtkButton): gtkLabel = gtkButton.children()[0] gtkLabel.set_text('Prueba') Sorry :( -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Fichero no encontrado . ¨ Me lo invento? (Y/N). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Button child
I need to get the label of a button in its signal handler... now the code that i use is: def ioCambiada(gtkButton): gtkLabel = gtkButton.children() print gtkLabel gtkLabel.set_text('Prueba') And the output is: [eferro@drako iopipe]$ ./virtualio.py [] Traceback (innermost last): File "/usr/lib/python1.5/site-packages/libglade.py", line 28, in __call__ ret = apply(self.func, a) File "./virtualio.py", line 25, in ioCambiada gtkLabel.set_text('Prueba') AttributeError: set_text So it seems that the gtkLabel have a correct GtkLabel object instance but it dont let me use the GtkLabel methods... i try with get() set_text() but neither of them work Any info about it -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia [incredibly rude and childish comments deleted] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Autoconect with libglade
El Wed, Apr 25, 2001 at 11:28:41AM -0600, Bill Anderson dijo: > On 25 Apr 2001 16:30:46 +0200, Eduardo Ferro wrote: > > > > Can i get the names of the handlers from a widget tree from a > > libglade? how? > > I want to use the autoconect without knowing the the names of the > > functions that i define at the glade file > > > > > Well, in one way or the other, you will have to know what they are, I do > not believe it is possible to avoid that, because at some point you need > to code the handlers for them. Yes, I explain bad that i want. I only want to avoid to explicity put a hand made dic to autoconect. I expect that i can get the handler names that contains the glade file to generate automaticaly the dictionary and to auto connect... of course I will generate this callbacks I will study the code that you send. it seems very interesting Thanks for the info/code -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Fatal Error Using Mouse. Replace and Bury Operator. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] libglade + gettext
What is the normal way to use international traslated mensages defined ina .glade file using python with libglade? Is there any aplication that use this??? Thanks in advance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia FATAL ERROR; SYSTEM HALTED; Press any key to do nothing. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Autoconect with libglade
Can i get the names of the handlers from a widget tree from a libglade? how? I want to use the autoconect without knowing the the names of the functions that i define at the glade file -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Pez que lucha contra la corriente, muere electrocutado. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Core with libglade
Hi! I am trying to use libglade to generate my application ui, but when y try to parse the glade file the process generate a core dump, and i don`t know where can i try to find the error The program is simple, only to test: #!/usr/bin/python import gtk import libglade def main(): print 'prueba' widgets = libglade.GladeXML('estconf.glade') print widgets gtk.mainloop() if __name__ == '__main__': main() The output is: -- [eferro@drako estconf]$ ./estconf.py GLib-CRITICAL **: file gstring.c: line 329 (g_string_prepend): assertion `val != NULL' failed. IMLIB ERROR: Cannot allocate XImage buffer Gdk-CRITICAL **: file gdkwindow.c: line 1406 (gdk_window_get_visual): assertion `window != NULL' failed. Segmentation fault (core dumped) -- My machine is a RedHat 6.2 with glade 0.6.0 and pygtk-libglade-0.6.6 python-1.5.2 pygnome-libglade-1.0.53 pythonlib-1.23-1 pygtk-0.6.6 pygnome-1.0.53 Any help? -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] http://www.todolinux.net/usuarios/eferro/ La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Pez que lucha contra la corriente, muere electrocutado. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] How to get widget size
Hi! I need to get the "actual" widget size of a Window, but when i request the size with size_request() it return me the minimal size that can use this widget :-? Someone knows how can i get this value??? Thanks in advance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia 640K ought to be enough for anybody. - Bill Gates, 1981 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Scroll dude
Hi! I have a ScrolledWindow with a GtkHBox() in it (added with add_with_viewport). Inside the GtkHBox i have some buttons and i want to change the scroll of the ScrolledWindow when some of the buttons get the focus... I only have some experience with Scrolled window containing GtkText or other kind of widget that control the scroll but i don`t understand how can i control the Scroll bar to see the correct part of the HBox Any suggestion, reading, or function to control this scrolls bars, and what widget must to do this control??? Thanks in advance and sorry for my poor english -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Todos prometen, nadie cumple . Vote por nadie ! ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] problem with add_timer & file reading
Hi! I use this code to try to log the contents of a file at a scrolled window. It read all the file and include the contents in the window, and later program a callback with the timeout_add function. When the callback is called, it read the file (because it could grow up) and add the new readed text to the window and to a list. The problem is that when i add some text to the open file, when the callback read the contents it dont`read the first one or two characters added... and it add a newline character to the string readed (i supose that it is the normal behaviour but i need to add only the real contents) Any suggestions would be apreciated Thanks in adavance class LogWindow: '''Clase para mostrar a modo de log lo leido de un fichero de texto''' def __init__(self,gtkContainer,fich,maxLineas): self.maxLineas = maxLineas self.numLineas = 0 self.intervalo = 1000 self.fich = fich self.gtkScrolledWindow = GtkScrolledWindow() gtkContainer.add(self.gtkScrolledWindow) self.gtkText = GtkText() self.gtkScrolledWindow.add_with_viewport(self.gtkText) self.gtkScrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.gtkScrolledWindow.show_all() self.lstLineas = [] self.timer = timeout_add(self.intervalo,self.checkFichero) def checkFichero(self): self.gtkText.freeze() linea = self.fich.read() while linea != '': print '"%s"', % linea self.lstLineas.append(linea) self.gtkText.insert_defaults(linea) linea = self.fich.read() self.gtkText.thaw() print 'checkFichero' return 'true' #-- def main(): gtkWindowMain = GtkWindow(type='toplevel') gtkWindowMain.connect('destroy',mainquit) fich = open('menu.txt','r') logWin = LogWindow(gtkWindowMain,fich,50) gtkWindowMain.show_all() mainloop() #---------- if __name__ == '__main__': main() -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia windows2000 "El insulto final" ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] focus dude
Hi! I need to create a program to generate a few buttons and the user must select one of then using the mouse or the keyboard. I want that the user use the cursor arrow keys to select the button and then press enter to run the asociated command. I want to show some kind of feedback to the user, for example i think that when it select some button with the keyboard the button background can be resalted like when the mouse pointer pass over the button How can i disable the color change of the button when the mouse pointer pass over the button? How can i change the keyboard focus to another widget and simulate that the mouse pointer has enter to this widget?? Thanks in advance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia ((HYPNOTIC(((TAG LINE ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] add_input problem
El Mon, Mar 19, 2001 at 01:06:50PM +0100, Eduardo Ferro dijo: > Hi > > I am trying to use the gdk input_add function to check a log file when > it grow, but when i use the following code, the function lectura is > called all the time, but the file don`t change its size :-? > Some suggestion about what is happening??? Someone tell me (at irc) that if i use select (or input_add) with a regular file it allways tell me that it is readable, so i can`t use this function to process the changes of the file -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Computers are not intelligent. They only think they are. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] add_input problem
Hi I am trying to use the gdk input_add function to check a log file when it grow, but when i use the following code, the function lectura is called all the time, but the file don`t change its size :-? Some suggestion about what is happening??? def lectura(fich,dos): lstLineas = fich.readlines() time.sleep(5) print lstLineas def main(): gtkWindowMain = GtkWindow(type='toplevel') gtkText = GtkText() gtkWindowMain.add(gtkText) fich = open('menu.txt','r') input_add(fich,INPUT_READ,lectura) gtkWindowMain.show_all() mainloop() Thanks in adavance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Windows: From the people who brought you EDLIN! ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Position of buttons
Hi! I have an aplication that have a VerticalBox with 2 widget, the first is a HorizontalBox and the last one is a Button, i need that the button only ocupies (verticaly) the minumun (just to read the label) and the HorizontalBox use the rest. Whe i start the aplication the button only ocupies the minimun but when i change the dimensions the buttons use half of the window size... How can i change this behaviour?? Thnaks in adavance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Mecagüenlap#&%$$... se ha cagao el ratón en la almohadilla!! ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How to get screen width and height
El Mon, Mar 12, 2001 at 09:59:33AM -0300, Andre Luis Lopes dijo: > Hi all > >Someone knows how to get the screen width and height ? I'm needing it to > be able to set a top level window size. > > I'm using : > > window = GtkWindow(WINDOW_TOPLEVEL) > window.set_usize(800, 600) > > But, it would be better if I could use : > > window = GtkWindow(WINDOW_TOPLEVEL) > window.set_usize(screen_widht, screen_height) > >Some volunteer to help me on this ? I don`t know if this is the better solution but is the only one that i know :) #!/usr/bin/env python from GDK import * from gnome.ui import * import gtk gdkRootWindow = gtk._root_window() print gdkRootWindow.height print gdkRootWindow.width -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia (E)macs (M)akes (A)ll (C)omputing (S)imple ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Any examples?
Hi! Anyone have a example of how can i log the stdout of a system call throught a scrolled window??? I suposes that it a very normal to use python+gtk for this task, but I can`t find a good example of it. I actually use a timer to perodically read from a pipe, but this solution don`t seems very good. Anyone know some program that do this using python+gtk to check the code??? Thanks in advance and sorry for my poor english -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia FATAL ERROR; SYSTEM HALTED; Press any key to do nothing. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Ioctl question
Hi! I have a python question not directily related with pygnome nor pygtk, but i supose that all off you know a lot off python, so sorry for the Offtopic (and for my english) I must do a call to a ioctl but this ioctl return me a estructure, i test some ioctl without parameter, or with structures, and it works, but the structure didn change... i don`t have any examples off ioctls with python... Is this chunk of code correct: chdr = struct.pack('BB',0,0) fcntl.ioctl(self.cd.fileno(),CDROMREADTOCHDR,chdr) print struct.unpack('BB',chdr) it allways print (0,0) but this ioctl change the structure... Any ioctls examples? any url about this issue? Thanks in advance and sorry for the offtopic -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Yo si sé lo que es trabajar duro, porque lo he visto. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Pygnome
El Tue, Feb 06, 2001 at 03:33:33PM -0200, Christian Robottom Reis dijo: > On 5 Feb 2001, Colin Fox wrote: > > > I'm working on an app using libglade and python. I have a window with a > > canvas in it, and I'd like to load a png file as an Image object in the > > root group of the canvas. > > AFAIK only gdk_imlib supports PNG and other files. GTK only operates on > XPM files, through the *pixmap_create_from_xpm* functions. > > > Does anyone know of a small program, or could anyone perhaps whip one > > up, that opens a window, creates a canvas, and adds an image canvas > > object to it? I don`t know if the gnome.ui.GnomePixmap can help you but i use pngs at some aplication with this widget... For example: #!/usr/bin/env python from GDK import * from gnome.ui import * from gtk import * gtkWindow = GtkWindow() gnoIcono = GnomePixmap('caution.png') gtkWindow.add(gnoIcono) gtkWindow.show_all() gtkWindow.connect('destroy',mainquit) mainloop() -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) [EMAIL PROTECTED] La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Windows error 000 : No errors found! [CLOSE] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Window position
Hi! I am trying to set the absolute position of a top window, but i can`t find the function. I test the set_position but it is`t that i want, i want to set the x and y position of the window Any suggestions??? -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) [EMAIL PROTECTED] La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia "Careful. We don't want to learn from this." -- Calvin ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Thread question
El Mon, Jan 29, 2001 at 04:33:48PM +0100, Aaron Optimizer Digulla dijo: > On Sun, Jan 28, 2001 at 06:39:40PM +0100, Eduardo Ferro wrote: > > > Hi everybody! > > > > I am trying to read some output from a system call, and i was looking > > for it at the mailing list archives,i found some tricks but i can`t > > use it. Now i am using a function run in an other thread with > > thread.start_new_thread > > > > I want to open with the os.popen a file and read from it from the main > > thread, but i don`t know how to do it, because i can`t access to this > > namespace, and i can`t so it with a global varible... > > usually, you want to read the file in the new thread and not main. > But if you meant that you want to open the file in main and read > it in the thread, then do this: > > thread.fh = os.popen (...) > > thread.start_new_thread () > > now the thread can use "self.fh" to access the open file. Thanks for the info! I now should kill externaly (from the main thread) the new thread generated by the start_new_thread function, now in the new thread i get the tid with get_ident and save it at global variable (bad practice i know, but it`s only for testing :-)) But i didn`t found a method to kill the thread like i usualy do in C Somobody know how to do this??? -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) [EMAIL PROTECTED] La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Mecagüenlap#&%$$... se ha cagao el ratón en la almohadilla!! ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Thread question
Hi everybody! I am trying to read some output from a system call, and i was looking for it at the mailing list archives,i found some tricks but i can`t use it. Now i am using a function run in an other thread with thread.start_new_thread I want to open with the os.popen a file and read from it from the main thread, but i don`t know how to do it, because i can`t access to this namespace, and i can`t so it with a global varible... Have someone so something similar??? Any help would be apreciated -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) [EMAIL PROTECTED] La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Every morning is the dawn of a new error... ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How can i draw at the root window
El Fri, Jan 19, 2001 at 07:08:05AM -0600, Charles G Waldman dijo: > Eduardo Ferro writes: > > > How can i draw some lines at the root_window? > > Here is a snippet of code I used to draw a grid on the > root window: > > from gtk import _root_window, draw_line > rw=_root_window() > cm=rw.colormap > yellow=cm.alloc("yellow") > rgc=rw.new_gc() > rgc.foreground=yellow > rgc.line_width=1 > w = rw.width > h = rw.height > for x in range(0,w,128): > draw_line(rw,rgc,x,0,x,h) > for y in range(0,h,128): > draw_line(rw,rgc,0,y,w,y) > Thanks for the info > > > How can i connect a evnent handler to the exposure event?? > > I'm not entirely sure but I think this may be impossible, since root > window events are handled by the window manager. But without the events it isn' t very usefull paint nothing at the root window. Any case i think that it should be possible because some C programs like root-tail do it, they repaint its output when some window erase it Anyway thanks a lot -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) [EMAIL PROTECTED] La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Mecagüenlap#&%$$... se ha cagao el ratón en la almohadilla!! ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] How can i draw at the root window
Hi! How can i draw some lines at the root_window? Now i get the GdkWindow and the Graphics Context, but i think that i need a gtkwidget too.. How can i connect a evnent handler to the exposure event?? Thanks in advance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) [EMAIL PROTECTED] La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia (A)bort, (R)etry, (F)orget It! ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Applet size
Hi! I am programming an applet but i can`t find documentation (only a example) Where'can i find more documentation??? How can i get the panel size to resize my widget to this size??? when i run my applet the panel icrease its size, i supose that the size default for my applet is wrong Any info would be apreciated Thanks in advance -- Hasta otra! Eduardo Ferro Aldama [EMAIL PROTECTED] (Linux User 58390-44335) [EMAIL PROTECTED] La web del GLUB http://glub.ehu.es/ Grupo Linux Usuarios de Bizkaia Lo importante no es saber, sino tener el telefono del que sabe. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk