Re: can't run python gui with Tkinter

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 15 Feb 2008 12:23:03 +0000

The problem (according to what is in the email) is that the code isn't
being indented. Python blocks must be indented. Either use a few spaces
(eg. 4, but be consistant with this) or use a tab for each indentation
level.

Also are you aware that tkinter is not accessible? By this I mean that
the usual ways for screen readers to access it don't work, although you
may have a little success with the screen review keys (eg. jaws cursor).

As for accessible GUI toolkits available in python, it depends on what
you need from it. If you are writing for a particular platform, then try
and use the native GUI stuff (eg. the win32 extensions in windows, pygtk
in linux, etc). If you want a cross platform GUI toolkit, then the news
isn't so good. wxpython (www.wxpython.org) tries to use the native
toolkits, but to try and get controls to be the same on different
platforms it isn't always 100% accessible. The only real cross platform
accessibility API I know of (which is actually in use) is the java
accessibility API, but how to use that from python? Well there are a few
possible modules, but none really seem good if it is purely for a GUI.

May be in the future QT will be properly accessible in Linux (it makes
accessibility information available, but doesn't use the normal API).

So unfortunately for those who want cross platform accessible GUIs will
need to try and make the best of wxpython.

Michael Whapples
On Fri, 2008-02-15 at 13:58 +0800, Jaffar@xxxxxxxxxxxxx wrote:
> Hi all.  Need some advice from the python experts on the list.  I am
> learning Tkinter gui programming with python.  I am trying to build a
> hello world program with text messages and buttons.  I used Ed sharp
> to write the code and used the py dent facility that came with this
> fantastic editor.  However, I always get an indentation error on the
> third line of the code whose  content is:
> def __init__(self, master)
> when i try to run it.  Here is the whole code.  Any help will be
> appreciated.
> Cheers!
> Code below:
> from Tkinter import *
> class App:
> def __init__(self, master)
> frame = Frame(master)
> frame.pack()
> self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
> self.button.pack(side=LEFT)
> self.hi_there = Button(frame, text="Hello", command=self.say_hi)
> self.hi_there.pack(side=LEFT)
> def say_hi(self):
> print "Hi there, everyone"
> root = Tk
> app = App(root)
> root.mainloop()
> 

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: