Re: PyGTK, Glade/libglade. What am I doing wrong?

2011-05-06 Thread craf
On May 6, 2011 7:05 PM, Даниил Рыжков daniil...@gmail.com wrote:

 Sorry for my English (I could not find help in the Russian community)
 I'm trying to learn PyGTK and Glade. I made test window in Glade and
 saved it as test.glade (attached). Then I wrote script
 test.py(attached, http://pastebin.com/waKytam3). I tried to run it.
 While the script was executed, console did not show anything and
 window wasn't displayed. When I pressed CTRL+С console displayed
 trackback:
 ---
 CTraceback (most recent call last):
  File test.py, line 32, in module
gtk.main()
 KeyboardInterrupt
 ---
 So what am I doing wrong?


I haven't used gtk before, but is there a show method or something
similar you need, to actually make the window appear? The
KeyboardInterrupt is normal. That's how control-c works.
 --
 Best wishes,
 Daniil

 --
 http://mail.python.org/mailman/listinfo/python-list


Hi.

Try this:

#!/usr/bin/env python

import gtk.glade

class TestPyGtk:
This is an Hello World GTK application

def __init__(self):

#Set the Glade file
self.gladefile = test.glade
self.glade = gtk.glade.XML(self.gladefile)

self.MainWindow = self.glade.get_widget('MainWindow')
self.MainWindow.show()
self.MainWindow.connect('destroy', lambda e:gtk.main_quit())



TestPyGtk()
gtk.main()

Regards.

Cristian.

List of Pygtk: http://www.daa.com.au/mailman/listinfo/pygtk





-- 
http://mail.python.org/mailman/listinfo/python-list


[OT] Disable creation of pyc files in DrPython

2011-04-20 Thread craf
Hi.

I wonder if anyone uses Python DrPython as editor.
I need to know if you can disable the creation of
Pyc files created by the program. In the Geany editor you can 
add the parameter -B, but not if it can in this editor.

Thanks in advance.

Regards

Cristian Abarzúa F

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Disable creation of pyc files in DrPython

2011-04-20 Thread craf


On 20.04.2011 15:21, craf wrote:
 Hi.

 I wonder if anyone uses Python DrPython as editor.
 I need to know if you can disable the creation of
 Pyc files created by the program. In the Geany editor you can
 add the parameter -B, but not if it can in this editor.

I don't know DrPython, but Python itself checks for the 
$PYTHONDONTWRITEBYTECODE environment variable. Perhaps you can run 
DrPython with a command like:

PYTHONDONTWRITEBYTECODE=1 drpython


HTH

Hi. Alexander.

Thanks for the information.


I'll prove it

Regards.

Cristian Abarzúa F

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE/text-editor

2011-04-16 Thread craf
Look this:

http://portableapps.com/apps/development/geany_portable


Regards.

Cristian


-- 
http://mail.python.org/mailman/listinfo/python-list


Sending pictures using sockets

2011-04-06 Thread craf
Hello.

I'm testing the sockets in Python and I've seen the way in which
works to send string. My question is if anyone knows where
can find some information on how to send pictures through
Sockets. I use Python 2.7 and have read the information regarding
Sockets of the Python website, but I can not begin.

Any help is welcome

Greetings.

Cristian Abarzúa F

-- 
http://mail.python.org/mailman/listinfo/python-list


Another location of the PyGTK tutorial

2011-04-03 Thread craf
Hi.

Anyone know if the pygtk tutorial that was in this direction
http://www.learnpygtk.org/pygtktutorial/index.html,  can be located
elsewhere.

Regards.

Cristian

-- 
http://mail.python.org/mailman/listinfo/python-list


Another location of the PyGTK tutorial

2011-04-03 Thread craf
Hi.

Anyone know if the pygtk tutorial that was in this direction
http://www.learnpygtk.org/pygtktutorial/index.html,  can be located
elsewhere.

Regards.

Cristian

-- 
http://mail.python.org/mailman/listinfo/python-list


about Pyclutter

2011-04-03 Thread craf
Hi

Does anyone know how mature is Pyclutter?.

Regards

Cristian Abarzúa 

-- 
http://mail.python.org/mailman/listinfo/python-list


[Fwd: Re: Another location of the PyGTK tutorial]

2011-04-03 Thread craf
¡Thank you very much Dotan!

Regards.

Cristian
- Mensaje reenviado 
 De: Dotan Cohen dotanco...@gmail.com
 Para: craf p...@vtr.net
 Cc: Python Ingles python-list@python.org
 Asunto: Re: Another location of the PyGTK tutorial
 Fecha: Sun, 3 Apr 2011 13:40:35 +0300
 
 http://gitorious.org/pygtk-tutorial
 
 On Fri, Apr 1, 2011 at 21:03, craf p...@vtr.net wrote:
  Hi.
 
  Anyone know if the pygtk tutorial that was in this direction
  http://www.learnpygtk.org/pygtktutorial/index.html,  can be located
  elsewhere.
 
  Regards.
 
  Cristian
 
  --
  http://mail.python.org/mailman/listinfo/python-list
 
 
 
 
 -- 
 Dotan Cohen
 
 http://gibberish.co.il
 http://what-is-what.com


-- 
http://mail.python.org/mailman/listinfo/python-list


[Fwd: Re: about Pyclutter]

2011-04-03 Thread craf
Thanks for the answer.

Regards.

Cristian
- Mensaje reenviado 
 De: Blockheads Oi Oi breamore...@yahoo.co.uk
 Para: python-list@python.org
 Asunto: Re: about Pyclutter
 Fecha: Sun, 03 Apr 2011 11:41:32 +0100
 
 On 02/04/2011 17:54, craf wrote:
  Hi
 
  Does anyone know how mature is Pyclutter?.
 
  Regards
 
  Cristian Abarzúa
 
 
 I don't kow about mature but from 
 http://wiki.clutter-project.org/wiki/PyClutter.
 
 WARNING: PyClutter only covers the 1.0 API, and it is going to be 
 deprecated in favour of introspection-based bindings using PyGObject.
 
 HTH.
 
 Mark L.
 


-- 
http://mail.python.org/mailman/listinfo/python-list


About list Pyclutter

2011-04-02 Thread craf
Hi.

Does anyone know if pyclutter has a mailing list?

Regards.

Cristian Abarzúa

-- 
http://mail.python.org/mailman/listinfo/python-list


site Pytgtk

2011-04-02 Thread craf
Hi.

Gtk tutorial on who was in this direction was excellent:
http://www.learnpygtk.org/pygtktutorial/index.html. Does anyone know by
chance if you are in pdf or moved to another site?

Regards.

Cristian Abarzúa F.

-- 
http://mail.python.org/mailman/listinfo/python-list


Prueba de correo

2011-04-02 Thread craf


-- 
http://mail.python.org/mailman/listinfo/python-list


[Fwd: Re: Calling function from another module]

2010-12-16 Thread craf
- Mensaje reenviado 
 De: Peter Otten __pete...@web.de
 Para: python-list@python.org
 Asunto: Re: Calling function from another module
 Fecha: Thu, 16 Dec 2010 13:16:30 +0100
 Grupos de noticias: comp.lang.python
 
 craf wrote:
 
  Hi.
  
  The query code is as follows:
  
  --
  import Tkinter
  import tkMessageBox
  
  
  class App:
  def __init__(self, master):
  master.protocol(WM_DELETE_WINDOW,quit)
  
  
  def quit():
  if tkMessageBox.askyesno('','Exit'):
  master.quit()
  
  
  master =Tkinter.Tk()
  app = App(master)
  master.mainloop()
  ---
  
  As you can see, when I run and close the main window displays
  a text box asking if you want to quit, if so, closes
  application.
  
  Question:
  
  Is it possible to define the quit() function in another separate
  module?.
  I tried it, but it throws the error that the global name
  'master' is not defined.
 
 You can have the modules import each other and then access the master as
 module.master where you'd have to replace module with the actual name of 
 the module, but that's a bad design because 
 
 (1) you create an import circle
 (2) functions relying on global variables already are a bad idea
 
 Your other option is to pass 'master' explicitly and then wrap it into a 
 lambda function (or functools.partial):
 
 $ cat tkquitlib.py
 import tkMessageBox
 
 def quit(master):
 if tkMessageBox.askyesno('','Exit'):
 master.quit()
 
 
 $ cat tkquit_main.py
 import Tkinter
 
 import tkquitlib
 
 class App:
 def __init__(self, master):
 master.protocol(WM_DELETE_WINDOW, lambda: tkquitlib.quit(master))
 
 master = Tkinter.Tk()
 app = App(master)
 master.mainloop()
 
 Peter

Hi Peter.

¡Right!. Your example can separate the creation of the interface to the
code execution. Thanks for your time.

Regards

Cristian

-- 
http://mail.python.org/mailman/listinfo/python-list


Calling function from another module

2010-12-15 Thread craf
Hi.

The query code is as follows:

--
import Tkinter
import tkMessageBox


class App:
def __init__(self, master):
master.protocol(WM_DELETE_WINDOW,quit)


def quit():
if tkMessageBox.askyesno('','Exit'):
master.quit()


master =Tkinter.Tk()
app = App(master)
master.mainloop()
---

As you can see, when I run and close the main window displays
a text box asking if you want to quit, if so, closes
application.

Question:

Is it possible to define the quit() function in another separate
module?.
I tried it, but it throws the error that the global name
'master' is not defined.

Thanks in advance.

Regards

Cristian Abarzúa




-- 
http://mail.python.org/mailman/listinfo/python-list


Alternative to PIL in Python 3.1

2010-12-14 Thread craf
Hi.

I wonder if anyone knows any alternative to PIL library, as this does
not work with Python 3.1.

Thanks in advance

Regards.

Cristian

-- 
http://mail.python.org/mailman/listinfo/python-list


[Fwd: Re: Alternative to PIL in Python 3.1]

2010-12-14 Thread craf
- Mensaje reenviado 
 De: Emile van Sebille em...@fenx.com
 Para: python-list@python.org
 Asunto: Re: Alternative to PIL in Python 3.1
 Fecha: Tue, 14 Dec 2010 16:39:19 -0800
 
 On 12/14/2010 3:17 PM craf said...
  Hi.
 
  I wonder if anyone knows any alternative to PIL library, as this does
  not work with Python 3.1.
 
  Thanks in advance
 
  Regards.
 
  Cristian
 
 
 
 You might try the 1.1.6 port referenced here:
 
 http://www.mail-archive.com/image-sig@python.org/msg02404.html
 
 Emile
 
Hi Emile.

Thanks for the info.

I'll try it.

Regards.

Cristian

-- 
http://mail.python.org/mailman/listinfo/python-list


[Fwd: Re: Using a window style in a Toplevel window]

2010-12-09 Thread craf
- Mensaje reenviado 
 De: Eric Brunel eric.bru...@pragmadev.nospam.com
 Para: python-list@python.org
 Asunto: Re: Using a window style in a Toplevel window
 Fecha: Thu, 09 Dec 2010 10:00:39 +0100
 Grupos de noticias: comp.lang.python
 
 In article mailman.185.1291395907.2649.python-l...@python.org,
  craf p...@vtr.net wrote:
 
  Hi.
  
  I use Python 3.1 and Tkinter.ttk 8.5 on Ubuntu 9.10.
  
  CODE:
  
  module:FMain.py
  
  from tkinter import ttk
  from FSecondWindow import *
  
  class App:
  def __init__(self,master):
  
  button1 = ttk.Button(master,text='Show
  TopLevel',command=lambda:window())
  button1.pack()
  
 
  master = Tk()
  app = App(master)
  style = ttk.Style()
  style.theme_use('clam')
  master.mainloop()
  
  
  module:FSecondWindow.py
  
  from tkinter import *
  from tkinter import ttk
  
  def window():
  t = Toplevel()
  button2 = Button(t,text='Hello').pack()
  
  
  CODE EXPLANATION:---
  
  1. From the main module FMain.py call the window function that is
  located in FSecondWindow module and create a toplevel window.
  
  2.I apply a theme called 'clam' to the master window to improve the
  appearance of their widgets.
  
  QUERY:--
  
  How I can make the toplevel window also take the theme 'clam'?
 
 Short answer: you can't. No directly anyway.
 
 Long answer: As you might be aware, there are 2 widget sets in 
 tk/tkinter, the old one for which classes are directly in the tkinter 
 module, and the new one that are in the ttk submodule. Only the second 
 set supports theming, not the first one. Unfortunately, there are a few 
 widgets that exist only in the first set, and Toplevel is one of those. 
 So no theming is directly available for toplevels, and you can change 
 whatever you want via style.theme_use, it won't be reflected on 
 toplevels.
 
 By the way, as you wrote the code above, it won't be reflected on your 
 button either, since you used the Button class, which is taken in 
 tkinter directly, so it is the old Button class, not the new one. To 
 get the new one, use ttk.Button, not Button.
 
 For your toplevel, there is however a simple workaround: Since there is 
 a Frame widget in the new widget set, you can simply insert such a frame 
 in your toplevel, make sure it will take the whole space, and then 
 insert your widgets in this frame rather than in the toplevel directly. 
 The code for your 'window' function would then become:
 
 def window()
 t = Toplevel()
 frm = ttk.Frame(t)
 frm.pack(fill=BOTH, expand=True)
 button2 = ttk.Button(frm, text='Hello')
 button2.pack()
 
 (Note also that I have put the creation of the button and its packing in 
 2 lines. You should never do variable = widget.pack(…) since pack does 
 not return the widget. It always returns None, so doing so won't put 
 your widget in the variable).
 
 The code above should do what you're after.
 
  Thanks in advance.
 
 HTH
  - Eric -


Hi Eric.

¡Thank you very much, for the answer.!

Regards

Cristian Abarzúa F

-- 
http://mail.python.org/mailman/listinfo/python-list


Using a window style in a Toplevel window

2010-12-03 Thread craf
Hi.

I use Python 3.1 and Tkinter.ttk 8.5 on Ubuntu 9.10.

CODE:

module:FMain.py

from tkinter import ttk
from FSecondWindow import *

class App:
def __init__(self,master):

button1 = ttk.Button(master,text='Show
TopLevel',command=lambda:window())
button1.pack()

   
master = Tk()
app = App(master)
style = ttk.Style()
style.theme_use('clam')
master.mainloop()


module:FSecondWindow.py

from tkinter import *
from tkinter import ttk

def window():
t = Toplevel()
button2 = Button(t,text='Hello').pack()


CODE EXPLANATION:---

1. From the main module FMain.py call the window function that is
located in FSecondWindow module and create a toplevel window.

2.I apply a theme called 'clam' to the master window to improve the
appearance of their widgets.

QUERY:--

How I can make the toplevel window also take the theme 'clam'?

Thanks in advance.

Regards.

Cristian Abarzúa.

-- 
http://mail.python.org/mailman/listinfo/python-list


[Fwd: Re: Decorate un Frame with window managers title bar, etc en Tkinter 8.5]

2010-12-02 Thread craf
- Mensaje reenviado 
 De: Eric Brunel eric.bru...@pragmadev.nospam.com
 Para: python-list@python.org
 Asunto: Re: Decorate un Frame with window managers title bar, etc en
 Tkinter 8.5
 Fecha: Thu, 02 Dec 2010 10:21:49 +0100
 Grupos de noticias: comp.lang.python
 
 In article mailman.101.1291218554.2649.python-l...@python.org,
  craf p...@vtr.net wrote:
 
  Hi.
  
  I use python 3.1 and Tkinter 8.5 in Ubuntu 9.10 
  
  I would like to turn a frame into a toolbox,
  ,and for that I read that you can use the command wm manage (window)
  
  The information can be found  at:
  http://www.tcl.tk/man/tcl8.5/TkCmd/wm.htm#M39
  
  the explanation says:
  
  wm manage widget:
  The widget specified will become a stand alone top-level window.
  The window will be decorated with the window managers title bar,
  etc. Only frame, labelframe and toplevel widgets can be used
  with this command. Attempting to pass any other widget type will
  raise an error. Attempting to manage a toplevel widget is benign
  and achieves nothing. See also GEOMETRY MANAGEMENT.
  
  I have tried to use it in Tkinter but I can not know how is its
  structure.
  
  In Tkinter should be:
  
  ---TEST CODE---
  
  from Tkinter import
  
  master = Tk()
  frame = Frame(master)
  wm_manager(Frame)
  master.mainloop()
  
  
  
  But this does not work.
 
 If your version of Tkinter supports it, then the correct syntax is:
 frame.wm_manage()
 Please note you have to call it on the Frame instance (the one you named 
 frame), and not on Frame with a big F which is the class.
 
 If it says the method doesn't exist (AttributeError raised on the line 
 frame.wm_manage()), you can also try to do it at tcl/tk level with the 
 line:
 master.tk.call('wm', 'manage', frame)
 
  I appreciate any of this item
 
 HTH
  - Eric -

Thank you very much Eric!

Regards.

Cristian.

-- 
http://mail.python.org/mailman/listinfo/python-list


Uso de variable Global

2010-12-02 Thread craf
Hola.


Estoy probando Tkinter y escribí este pequeño código el cual crea un
formulario con un textbox y un botón. Al ingresar un dato en el textbox
y presionar el botón, se imprime en la consola el valor.


---CODE

from Tkinter import * 

def muestra():
print(valor.get())

class App:
def __init__(self,master):
global valor
valor = StringVar()
e = Entry(master,textvariable=valor).pack()
b = Button(master,text='Mostrar',command=muestra).pack()


master = Tk()
app = App(master)
master.mainloop()

-

Funciona, pero tuve que hacer uso de una variable Global.

Pregunta: ¿Es valida esta forma?, ¿Se puede hacer de otra forma, sin
ocuparla?.

Saludos.

Cristian



-- 
http://mail.python.org/mailman/listinfo/python-list


[Fwd: Re: Uso de variable Global]

2010-12-02 Thread craf
- Mensaje reenviado 
 De: Peter Otten __pete...@web.de
 Para: python-list@python.org
 Asunto: Re: Uso de variable Global
 Fecha: Thu, 02 Dec 2010 23:06:25 +0100
 Grupos de noticias: comp.lang.python
 
 craf wrote:
 
  Hola.
  
  
  Estoy probando Tkinter y escribí este pequeño código el cual crea un
  formulario con un textbox y un botón. Al ingresar un dato en el textbox
  y presionar el botón, se imprime en la consola el valor.
  
  
  ---CODE
  
  from Tkinter import *
  
  def muestra():
  print(valor.get())
  
  class App:
  def __init__(self,master):
  global valor
  valor = StringVar()
  e = Entry(master,textvariable=valor).pack()
  b = Button(master,text='Mostrar',command=muestra).pack()
 
 pack() returns None so both e and b set to None here. In this case it 
 doesn't matter because you don't do anything with e and b.
 
  master = Tk()
  app = App(master)
  master.mainloop()
  
  -
  
  Funciona, pero tuve que hacer uso de una variable Global.
  
  Pregunta: ¿Es valida esta forma?, ¿Se puede hacer de otra forma, sin
  ocuparla?.
 
 I'd prefer to make valor an attribute and muestra() a method:
 
 from Tkinter import * 
 
 class App:
 def __init__(self, master):
 self.valor = StringVar()
 Entry(master, textvariable=self.valor).pack()
 Button(master, text='Mostrar', command=self.muestra).pack()
 def muestra(self):
 print self.valor.get()
 
 master = Tk()
 app = App(master)
 master.mainloop()
 

Thanks!, Sorry for the Spanish mail.

Regards

Cristian


-- 
http://mail.python.org/mailman/listinfo/python-list


Decorate un Frame with window managers title bar, etc en Tkinter 8.5

2010-12-01 Thread craf
Hi.

I use python 3.1 and Tkinter 8.5 in Ubuntu 9.10 

I would like to turn a frame into a toolbox,
,and for that I read that you can use the command wm manage (window)

The information can be found  at:
http://www.tcl.tk/man/tcl8.5/TkCmd/wm.htm#M39

the explanation says:

wm manage widget:
The widget specified will become a stand alone top-level window.
The window will be decorated with the window managers title bar,
etc. Only frame, labelframe and toplevel widgets can be used
with this command. Attempting to pass any other widget type will
raise an error. Attempting to manage a toplevel widget is benign
and achieves nothing. See also GEOMETRY MANAGEMENT.

I have tried to use it in Tkinter but I can not know how is its
structure.

In Tkinter should be:

---TEST CODE---

from Tkinter import

master = Tk()
frame = Frame(master)
wm_manager(Frame)
master.mainloop()



But this does not work.

I appreciate any of this item

Regards.


Cristian Abarzúa

-- 
http://mail.python.org/mailman/listinfo/python-list