473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

porting from Tkinter to pygtk

I am in the process of learning pygtk and I would like to port
some custom made Tkinter widgets to pygtk, just an exercise.
For instance I have this code:

.. from Tkinter import *
..
.. class AnimatedLabel(Label):
.. def __init__(self, master, text, width=72, maxspc=16, deltat=100,
**kw):
.. self.text = text
.. self.width = width
.. self.maxspc = maxspc
.. self.deltat = deltat
.. self.stringvar = StringVar(master)
.. self.stringvar.set(text)
.. self.stop = False
.. Label.__init__(self, master, textvariable=self.stringvar,
**kw)
..
.. def startAnimation(self, spaces='', addspace=False):
.. if len(spaces) == 0 or len(spaces) == self.maxspc:
.. addspace = not addspace
.. if addspace: # add a space
.. spaces += ' '
.. else: # remove a space
.. spaces = spaces[1:]
.. if not self.stop: # repeat each 100 ms changing spaces and
addspace
..
self.stringvar.set(spaces.join(self.text).center(s elf.width))
.. self.after(self.deltat, self.startAnimation, spaces,
addspace)
..
.. def stopAnimation(self):
.. self.stop = True
..
..
.. if __name__ == "__main__":
.. t = Tk()
.. t.title('Example')
.. t.config(background='green')
..
.. a = AnimatedLabel(t, text="Hello", fg='blue', bg='green')
.. a.pack()
.. a.startAnimation()
.. t.mainloop()

what's the equivalent of the .after() method in pygtk?
BTW, is there any intro to pygtk thought for Tkinter users?
TIA,

Michele Simionato

Jul 18 '05 #1
0 1308

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: srijit | last post by:
Hello, Any idea - why the following code crashes on my Win 98 machine with Python 2.3? Everytime I run this code, I have to reboot my machine. I also have Win32all-157 installed. from Tkinter...
5
by: carljohan.rehn | last post by:
I would like like to start doing some GUI-programming in Python, but don't know which library to choose. Tkinter seems a bit old. Correct me if I am wrong! The layout doesn't look as nice as for...
0
by: Sebastien Aubry | last post by:
Hello, I happen to use in my programs a widget based on Tkinter Canvas. It is Zinc (http://www.tkzinc.org), which allows to draw using transparency, gradients, translations, rotations, ... using...
0
by: Sebastien Aubry | last post by:
Hello, I am trying to embed a Tkinter widget (TkZinc, http://www.tkzinc.org) inside a PyGtk HMI. A guru gave me this advice: "I think you can do some magic using the XID of the Tkinter...
8
by: JyotiC | last post by:
I want to make a stand alone gui. Whose work is to get the diff options from user and run a shell script based on them. I wanna know which one is better to use Tkinter or PyGTK, in terms of...
32
by: Kevin Walzer | last post by:
I'm a Tcl/Tk developer who has been working, slowly, at learning Python, in part because Python has better support for certain kinds of applications that I want to develop than Tcl/Tk does....
2
by: sandip desale | last post by:
Dear All, We have a Tcl/Tk application written using Python 2.2. Using this application we want to call some customizable Java APIs. I tried porting Tcl/Tk application to Jython but not able to do...
4
by: fabdeb | last post by:
Hi every one, I m a sysadmin who want to know how to use python. I dont know anything about oriented object programation, i only know bash and a little perl. I have some simple questions about...
0
by: Michael Palmer | last post by:
On Sep 16, 12:30 pm, binaryjesus <coolman.gu...@gmail.comwrote: I haven't tried it myself, but I came across a blog post the other day that describes a way of building windows installers for...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.