boB Stepp | 18 Jul 06:17 2015

How to use tkinter with a touch screen device?

I was advised to bring my question(s) on this topic to this list...

---------- Forwarded message ----------
From: boB Stepp <robertvstepp <at>>
Date: Fri, Jul 17, 2015 at 5:04 PM
Subject: How to use tkinter with a touch screen device?
To: tutor <tutor <at>>

Apparently I will be finding myself having to write some programs to
run on a Samsung Slate tablet, manufactured circa 2011.  It has
Windows 7 home edition 64-bit as its OS.  Hopefully Python 3 will be
easily installed, and I will be able to run Python 3 programs on it.
Operating under this assumption, what adjustments will I need to make
in order to use tkinter for GUIs on this device?  So far my searches
have not found targeted information (yet).  One thing I did find is
that complex gestures are not supported by tkinter.  But will tkinter

1) Short presses as a left mouse click?
2) Long presses as a right mouse click?
3) Virtual keyboard events the same as physical keyboard events?
4) Etc. ?

Any useful info along these lines will be greatly appreciated!
Otherwise, I will do the usual once I get this tablet updated and
Python installed:  Barge ahead, write some code, and see what happens!


(Continue reading)

Vasilis Vlachoudis | 25 Jun 12:17 2015

Centering grid inside a frame

Hi all,

I want to centre a grid layout (with fixed size) inside a frame
e.g. if I do the following

tk = Tk()
Button(tk, text="button1").grid(row=0, column=0, sticky=NSEW)
Button(tk, text="button2").grid(row=0, column=1, sticky=NSEW)
Button(tk, text="button3").grid(row=1, column=0, sticky=NSEW)
Button(tk, text="button4").grid(row=1, column=1, sticky=NSEW)

on python 2.7 I get the 4 buttons anchored on the NW corner of the tk frame
If I resize the window the buttons are stuck there.

I know that I could add an additional frame and use the place manager like
f = Frame(tk), rely=0.5, anchor=CENTER)
and change all buttons to belong to f.

However on python 2.4 I get the 4 buttons perfectly centred in the tk frame
without the additional f-frame.
Is there a special flag that I could do the centering without the need of the extra frame.

Thanks in advance

Tkinter-discuss mailing list
Tkinter-discuss <at>
Ned Deily | 19 Jun 20:38 2015

Re: IDLE can't be opened

[Petr, please reply to the mailing list, not directly to me, so that others can contribute to or benefit from
the discussion.  Thanks!]

On Jun 18, 2015, at 08:46, Petr Tvrdik <ptvrdik <at>> wrote:
> I have noticed that even inside my /usr/local/bin/ directory, idle2.7 or idle3.4 commands do not work
> however, when I use ’sudo idle2.7’ or ’sudo idle3.4’ both work flawlessly with the new ActiveTcl 
> so my problem seems to be more related to root privileges and unix folder structure perhaps

Are you by any chance trying to launch idle when you have changed your working directory to /usr/local/bin? 
You shouldn't do that.

Try the following:

cd ~
sudo rm -rf .idlerc
cd Desktop

and see if that works.  You should never have to run idle undo sudo and you never should!

  Ned Deily
  nad <at> -- []

Tkinter-discuss mailing list
Tkinter-discuss <at>
Ned Deily | 17 Jun 22:53 2015

Re: IDLE can't be opened

[returning the discussion to the list]

On Jun 17, 2015, at 09:31, Petr Tvrdik <ptvrdik <at>> wrote:
>> On Jun 16, 2015, at 6:37 PM, Ned Deily <nad <at>> wrote:
>> In article <01AD415B-C98C-433B-95D9-59731D9D40BA <at>>,
>> Petr Tvrdik <ptvrdik <at>> wrote:
>>> I have installed Python IDLE from
>>> When I launch the IDLE program I get the error message "The application IDLE 
>>> can't be opened."
>>> However, the application WORKS IN ANOTHER ACOUNT on the same machine (Macbook 
>>> Pro, mid 2010, updated to Yosemite 10.10.3)
>>> I have also installed the latest ActiveTcl (buildno 298892) (which is the one 
>>> recommended for the OS 
>>> [ActiveTcl8.]
>>> What can I do to make this work? Possible interference with another tkinter? 
>>> From this or the other login account?
>> [...]

>> Nevertheless, a few suggestions: you didn't say which version of Python 
>> you installed and are trying to use (the currently supported versions 
>> are 3.4.3 and 2.7.10).  Each will install its own version of IDLE.  When 
>> you launch IDLE by double-clicking on its icon in an 
>> /Applications/Python x.x folder, many error messages that might be 
>> generated during launch are not displayed directly to you, rather they 
>> go into system logs that can be views with the Console app.  However, it 
>> is easier to see the errors if you try to start IDLE directly from 
>> within a terminal sesssion, for example with Terminal app.  If you used 
>> the install defaults, try typing either:
>> /usr/local/bin/idle3.4
>> or
>> /usr/local/bin/idle2.7
>> and see what happens.  There are sometimes problems due to values set in 
>> IDLE's per-user preference files.  You can remove them before launching 
>> IDLE by typing in the terminal session:
>> rm -r ~/.idlerc
> Thank you for your input. I have uninstalled and reinstalled Python2.7 and Python3.4 and ActiveTCL (the
recommended version 8.5.18)
> Now, when I type idle2.7 in my /usr/local/bin/idle2.7, idle window opens with warning:Tcl/Tk 8.5.9 in
use is unstable (attached).
> when I type idle3.4, I get this: -bash: idle3.4: command not found
> Is it possible that something got mis-wired in my shell scripts?

From the attached screenshots, the IDLE that you have launched is the one included with the OS X system
Python (2.7.6), not the latest from and that explains why you get the "8.5.9 in use" warning.  I
suspect you didn't enter the full path as I suggested above; in the shell window, type the full path
"/usr/local/bin/idle2.7" not just "idle2.7".  That should ensure that the correct IDLE launches and
then, if it still fails, you can see why.  You could then also try launching a new terminal window and see
whether just typing "idle2.7" gives you the newer version; if not, you may need to adjust your shell
startup scripts.  The Python installer should have done that by default.

  Ned Deily
  nad <at> -- []
Petr Tvrdik | 16 Jun 18:51 2015

IDLE can't be opened


I have installed Python IDLE from

When I launch the IDLE program I get the error message “The application IDLE can’t be opened.”

However, the application WORKS IN ANOTHER ACOUNT on the same machine (Macbook Pro, mid 2010, updated to Yosemite 10.10.3)

I have also installed the latest ActiveTcl (buildno 298892) (which is the one recommended for the OS [ActiveTcl8.]

What can I do to make this work? Possible interference with another tkinter? From this or the other login account?

Thank you for your input!

Best wishes,

Petr Tvrdik
Tkinter-discuss mailing list
Tkinter-discuss <at>
memilanuk | 7 May 11:07 2015

Third-party ttk themes

So... using Anaconda 2.2.0 / Python 3.4.3 on Linux, and the only ttk 
themes that came with are 'clam', 'alt', 'default' and 'classic'.  I've 
seen reference to other theme names like 'aqua', 'step', 'winnative', 
'vista' and 'xpnative'.  Are these themes - or others like them - 
available somewhere, some sort of theme repository?




Shiny!  Let's be bad guys.

Reach me  <at>  memilanuk (at) gmail dot com
Vasilis Vlachoudis | 31 May 11:21 2015

(no subject)

Hi All,

my question is not tkinter related but I could not find any help on that
I am compiling a list of commands for faster access in my application.
How can I check the type of a compiled object with isinstance()?

>>> c = compile("x+y","","eval")

>>> isinstance(c,code)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'code' is not defined

While type(c) gives a "code" object?

>>> c
<code object <module> at 0xb74a5cc8, file "", line 1>

>>> type(c)
<type 'code'>

Thanks in advance

From: Tkinter-discuss [ <at>] on
behalf of Kevin Walzer [kw <at>]
Sent: 19 May 2015 00:59
To: tkinter-discuss <at>
Subject: Re: [Tkinter-discuss] problems with Aqua Tcl/Tk core_8_5_branch        2015-04-28

On 5/18/15 3:17 PM, Russell Owen wrote:
> As to padding: the problem seems to be that the width computation for
> labels is overly generous: they use up far more width than they need,
> making some of my windows 25% or more wider, with lots of unwanted
> blank space. Buttons look great, but why were labels changed? They
> were fine, and looked much better before with versions 2015-03-24 and
> older.
Internally, labels are just another kind of button, so I suppose that
padding changes will affect them too. The previous tight padding made
the regular buttons look terrible, much worse than the labels do.

I'll see if I can take a look at the labels, but my time is much tighter
these days, so it may be awhile.


Kevin Walzer
Code by Kevin/Mobile Code by Kevin

Tkinter-discuss mailing list
Tkinter-discuss <at>
Russell Owen | 15 May 20:38 2015

problems with Aqua Tcl/Tk core_8_5_branch 2015-04-28

I built Tcl/Tk core_8_5_branch from the 2015-04-28 commit (in the git 
mirror) on OS X 10.9 with MACOS_X_DEPLOYMENT_TARGET=10.6. Visually the 
results are not as nice as code using the 2015-03-24 commit. It seems 
that many widgets, including labels and texts, take up far more room 
than they used to, with the extra room used for unnecessary whitespace. 
The results is far more different from Unix than it used to be.

One improvement is that button text is now displayed with some padding, 
making them much more readable, and more like unix (in a good way, since 
it is easier to write cross-platform code; I had been adding padding on 
OS X). But it seems that too many other controls got the same treatment, 
even if they didn't need it.

Also, both versions of Tcl/Tk have a bug whereby windows are often 
impossible to close. Clicking the close control and typing cmd-W both do 
nothing. Fortunately they can still be minimized, but it's disturbing 
not to be able to close them. Unfortunately this is intermittent, though 
common, making it hard to present a small example. Has anyone else seen 

-- Russell

P.S. binaries are here:
jevan | 18 Mar 02:49 2015

Is there a way to scroll Tkinter.Text widget by pixel instead of see() (which scrolls by line)?


When I type in the Text widget the text lines wrap toward the bottom of the page, the caret reaches the bottom of the Text widget. When I hit return, the caret dissapears out of view. When I type a character, the view finally scrolls up one line allowing me to see the character just typed.


See doesn't seem to want to show this next line always, so I can't see. Is there a way scroll the Text widget by pixel, so I can get pixel perfect scrolling?  And/or how do I get the line that get the carriage return to allways bee seen on a enter?


FYI: I am breaking each character because I have to custom process each character because the editor has several custom formating things that must occur. So the Enter is actually put in with Text.insert(), not after I have return 'break' in from the keypress event. Could this be something to do with it?

Alle Postfächer an einem Ort. Jetzt wechseln und E-Mail-Adresse mitnehmen! Rundum glücklich mit freenetMail
Tkinter-discuss mailing list
Tkinter-discuss <at>
Vasilis Vlachoudis | 9 Mar 16:01 2015

Persistent Listbox selection

Dear all,

how can I keep the listbox selection persistent when user selects something in the entry?
In the following example, the rows 0 to 10 are selected in the listbox
If you click and select something in the entry box the selection is lost
Is there an option to avoid this behaviour?

Best Regards

from Tkinter import *
tk = Tk()

listbox = Listbox(tk, selectmode=EXTENDED, exportselection=True)
listbox.pack(fill=BOTH, expand=YES)
for i in range(100): listbox.insert(END,"line %d"%(i))

entry = Entry(tk)
entry.pack(side=BOTTOM, fill=X)
entry.insert(0,"Hello world")
Tkinter-discuss mailing list
Tkinter-discuss <at>
kamal_17 | 24 Feb 15:38 2015

Redirecting command prompt to a gui realtime


I want to redirect output of a script into a gui window in realtime.

Please share some code snippet where u have encountered similar issue.


View this message in context:
Sent from the Python - tkinter-discuss mailing list archive at