473,804 Members | 3,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(L abel):
.. 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(maste r)
.. self.stringvar. set(text)
.. self.stop = False
.. Label.__init__( self, master, textvariable=se lf.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).cen ter(self.width) )
.. self.after(self .deltat, self.startAnima tion, spaces,
addspace)
..
.. def stopAnimation(s elf):
.. self.stop = True
..
..
.. if __name__ == "__main__":
.. t = Tk()
.. t.title('Exampl e')
.. t.config(backgr ound='green')
..
.. a = AnimatedLabel(t , text="Hello", fg='blue', bg='green')
.. a.pack()
.. a.startAnimatio n()
.. 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 1332

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

Similar topics

3
7037
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 import * class App:
5
4765
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 the others. wxPython seems to be the first-hand choice for people doing W32-programming (with MFC-experience). PyGtk seems to be a modern, very clean and nice approach, but with poor
0
1495
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 OpenGL. However, this widget depends on Tkinter, whose look I find oldy, though I would like to try PyGtk or wxPython. I would like to know if there is a method for using a Tkinter widget
0
1679
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 widget's window to produce a GdkWindow" I wrote this little program, which gets the XID of the Tkinter window and uses it to create a gtk.gdk.Window.
8
16724
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 efficiency and functionality. I hv read about Tkinter, but it takes too much time to load, is there a way to make it faster. Is all gui take more time to load, this is the first time i am making a gui.
32
7508
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. Naturally, I thought that I would use Tkinter as the GUI for these programs. However, in doing research into GUI development techniques, sample code, and showcase applications, what has struck me is how little sophisticated GUI development seems to be...
2
3846
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 the same as TKinter library is not available with JYthon. Can you please help me in porting Tkinter application to Jython? Also kindly let me know how to do the same. Thanks & Regards, Sandip Desale
4
2001
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 python. the first: what is the differences between a function and a classe? In which case i should use a function ? In which case i should use a class ?
0
1788
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 pyGTK applications at http://unpythonic.blogspot.com/2007/07/pygtk-py2exe-and-inno-setup-for-single.html
0
9704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10302
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.