boB Stepp | 18 Jul 06:17 2015
Picon

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> gmail.com>
Date: Fri, Jul 17, 2015 at 5:04 PM
Subject: How to use tkinter with a touch screen device?
To: tutor <tutor <at> python.org>

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
see:

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!

--
boB

(Continue reading)

Vasilis Vlachoudis | 25 Jun 12:17 2015
Picon
Picon

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)
tk.mainloop()

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)
f.place(relx=0.5, 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
Vasilis

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
Ned Deily | 19 Jun 20:38 2015
Picon

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> genetics.utah.edu> 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
/usr/local/bin/idle2.7

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

--
  Ned Deily
  nad <at> acm.org -- []

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
Ned Deily | 17 Jun 22:53 2015
Picon

Re: IDLE can't be opened

[returning the discussion to the list]

On Jun 17, 2015, at 09:31, Petr Tvrdik <ptvrdik <at> genetics.utah.edu> wrote:
>> On Jun 16, 2015, at 6:37 PM, Ned Deily <nad <at> acm.org> wrote:
>> In article <01AD415B-C98C-433B-95D9-59731D9D40BA <at> genetics.utah.edu>,
>> Petr Tvrdik <ptvrdik <at> genetics.utah.edu> wrote:
>>> I have installed Python IDLE from https://www.python.org/downloads/
>>> 
>>> 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.5.18.0.298892-macosx10.5-i386-x86_64-threaded.dmg]
>>> 
>>> 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 python.org 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> acm.org -- []
Petr Tvrdik | 16 Jun 18:51 2015
Picon

IDLE can't be opened

Hello,

I have installed Python IDLE from https://www.python.org/downloads/

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.5.18.0.298892-macosx10.5-i386-x86_64-threaded.dmg]

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> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
memilanuk | 7 May 11:07 2015
Picon

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?

Thanks,

Monte

--

-- 
Shiny!  Let's be bad guys.

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

(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
Vasilis

________________________________________
From: Tkinter-discuss [tkinter-discuss-bounces+vasilis.vlachoudis=cern.ch <at> python.org] on
behalf of Kevin Walzer [kw <at> codebykevin.com]
Sent: 19 May 2015 00:59
To: tkinter-discuss <at> python.org
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

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
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 
this?

-- Russell

P.S. binaries are here:
<http://www.astro.washington.edu/users/rowen/python/>
jevan | 18 Mar 02:49 2015
Picon

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> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
Vasilis Vlachoudis | 9 Mar 16:01 2015
Picon
Picon

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
Vasilis

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))
listbox.selection_set(0,10)

entry = Entry(tk)
entry.pack(side=BOTTOM, fill=X)
entry.insert(0,"Hello world")
tk.mainloop()
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
kamal_17 | 24 Feb 15:38 2015
Picon

Redirecting command prompt to a gui realtime

Hi,

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.

Thanks,
Kamlendra

--
View this message in context: http://python.6.x6.nabble.com/Redirecting-command-prompt-to-a-gui-realtime-tp5087377.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.

Gmane