Daniel Graham, Ph.D. | 23 Aug 15:11 2015

Re: Tkinter-discuss Digest, Vol 136, Issue 3

I use fnmatch:

    for path, dirs, files in os.walk(root):
        # exclude dirs
        dirs[:] = [os.path.join(path, d) for d in dirs
                   if not fnmatch.fnmatch(d, exclude)]
        # exclude files
        files = [os.path.join(path, f) for f in files
                 if not fnmatch.fnmatch(f, exclude)]

where 

    exclude=r’.*’

-Dan

On Aug 23, 2015, at 6:00 AM, tkinter-discuss-request <at> python.org wrote:

Send Tkinter-discuss mailing list submissions to
tkinter-discuss <at> python.org

To subscribe or unsubscribe via the World Wide Web, visit
https://mail.python.org/mailman/listinfo/tkinter-discuss
or, via email, send a message with subject or body 'help' to
tkinter-discuss-request <at> python.org

You can reach the person managing the list at
tkinter-discuss-owner <at> python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Tkinter-discuss digest..."


Today's Topics:

  1. tkinter file dialog pattern matching (Laura Creighton)
  2. Re: tkinter file dialog pattern matching (Pawel Mosakowski)
  3. Re: tkinter file dialog pattern matching (Laura Creighton)
  4. Re: tkinter file dialog pattern matching (Cameron Laird)


----------------------------------------------------------------------

Message: 1
Date: Sat, 22 Aug 2015 13:03:46 +0200
From: Laura Creighton <lac <at> openend.se>
To: tkinter-discuss <at> python.org
Subject: [Tkinter-discuss] tkinter file dialog pattern matching
Message-ID: <201508221103.t7MB3kdx010426 <at> fido.openend.se>
Content-Type: text/plain; charset="us-ascii"

Somebody on the tutor mailing list wants to match
"all files and direcories in this directory that do not start
with a ."

The filetypes option seems only to want patterns to match, not
patterns to exclude.  Is my pattern matching magic just off, or
is there no way to exclude things in a tkFileDialog?

puzzled,
Laura


------------------------------

Message: 2
Date: Sat, 22 Aug 2015 21:04:24 +0100
From: Pawel Mosakowski <pawel <at> mosakowski.net>
To: tkinter-discuss <at> python.org
Subject: Re: [Tkinter-discuss] tkinter file dialog pattern matching
Message-ID: <20150822210424.321b826f <at> lenny>
Content-Type: text/plain; charset=US-ASCII

Hi,

I've found this little gem in the Tk docs
https://www.tcl.tk/man/tcl8.4/TkCmd/getOpenFile.htm#M13
From what I see "file patterns" in the file dialog are not "regex
patterns" and do not support special characters. Only things that work
are:
1) * - any extension
2) "" - files without extension
3) literal extension without wildcard chars
Unfortunately it looks like there is no simple way to filter out hidden
files.
Check out this answer
https://mail.python.org/pipermail//tutor/2011-November/086483.html

Regards,
Pawel Mosakowski

On Sat, 22 Aug 2015 13:03:46 +0200
Laura Creighton <lac <at> openend.se> wrote:

Somebody on the tutor mailing list wants to match
"all files and direcories in this directory that do not start
with a ."

The filetypes option seems only to want patterns to match, not
patterns to exclude.  Is my pattern matching magic just off, or
is there no way to exclude things in a tkFileDialog?

puzzled,
Laura
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss



------------------------------

Message: 3
Date: Sat, 22 Aug 2015 22:17:11 +0200
From: Laura Creighton <lac <at> openend.se>
To: Pawel Mosakowski <pawel <at> mosakowski.net>
Cc: tkinter-discuss <at> python.org, lac <at> openend.se
Subject: Re: [Tkinter-discuss] tkinter file dialog pattern matching
Message-ID: <201508222017.t7MKHBac022500 <at> fido.openend.se>
Content-Type: text/plain; charset="us-ascii"

In a message of Sat, 22 Aug 2015 21:04:24 +0100, Pawel Mosakowski writes:
Hi,

I've found this little gem in the Tk docs
https://www.tcl.tk/man/tcl8.4/TkCmd/getOpenFile.htm#M13
From what I see "file patterns" in the file dialog are not "regex
patterns" and do not support special characters. Only things that work
are:
1) * - any extension
2) "" - files without extension
3) literal extension without wildcard chars
Unfortunately it looks like there is no simple way to filter out hidden
files.
Check out this answer
https://mail.python.org/pipermail//tutor/2011-November/086483.html

Regards,
Pawel Mosakowski

Thank you.  Looks like it will be necessary to construct a new
widget.  I'm surprised ...

Laura



------------------------------

Message: 4
Date: Sat, 22 Aug 2015 22:51:02 +0000
From: Cameron Laird <Cameron <at> phaseit.net>
To: Laura Creighton <lac <at> openend.se>
Cc: tkinter-discuss <at> python.org
Subject: Re: [Tkinter-discuss] tkinter file dialog pattern matching
Message-ID: <20150822225102.GA12242 <at> lairds.us>
Content-Type: text/plain; charset=us-ascii

On Sat, Aug 22, 2015 at 10:17:11PM +0200, Laura Creighton wrote:
In a message of Sat, 22 Aug 2015 21:04:24 +0100, Pawel Mosakowski writes:
Hi,

I've found this little gem in the Tk docs
https://www.tcl.tk/man/tcl8.4/TkCmd/getOpenFile.htm#M13
From what I see "file patterns" in the file dialog are not "regex
patterns" and do not support special characters. Only things that work
are:
1) * - any extension
2) "" - files without extension
3) literal extension without wildcard chars
Unfortunately it looks like there is no simple way to filter out hidden
files.
Check out this answer
https://mail.python.org/pipermail//tutor/2011-November/086483.html

Regards,
Pawel Mosakowski

Thank you.  Looks like it will be necessary to construct a new
widget.  I'm surprised ...
.
.
.
More than I.  I can understand your disappointment that 
file-dialogue "file patterns" have such a rudimentary
syntax; I speculate with considerable confidence that
the authors acted with sh as the model most in their
mind.  You're quite right, Laura, that the elements are
at hand to allow you to construct your own variant.  If
the history of getOpenFile truly interests you, act 
quickly:  while we can get to the authors now, it won't
be many cycles more before their memories and records
senesce irretrievably.


------------------------------

Subject: Digest Footer

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss


------------------------------

End of Tkinter-discuss Digest, Vol 136, Issue 3
***********************************************

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss
Laura Creighton | 22 Aug 13:03 2015
Picon

tkinter file dialog pattern matching

Somebody on the tutor mailing list wants to match
"all files and direcories in this directory that do not start
with a ."

The filetypes option seems only to want patterns to match, not
patterns to exclude.  Is my pattern matching magic just off, or
is there no way to exclude things in a tkFileDialog?

puzzled,
Laura
Pawel Mosakowski | 18 Aug 00:13 2015
Picon

new ttk theme made with theme_create() doesn't inherit from parent

Hi,

When I create a new theme and set it to inherit from already existing
one, the new theme comes up empty. It has no elements and buttons
displayed with it show only label, no other layout components.

I have no idea if it's normal behaviour or something is wrong with my
setup. Maybe I'm just using it wrong. I'm running Python 3.4.3 with tk
8.6.4 on Arch Linux.

===============================================
Test program
===============================================
import tkinter as tk
import tkinter.ttk as ttk

style = ttk.Style()

print('Available themes: ', style.theme_names())

print('\nSetting theme to default')
style.theme_use('default')

print('\nDisplaying theme "{0}" elements'.format(style.theme_use()))
print(style.element_names())

print('\nCreating new theme')
style.theme_create('new_theme', parent='default')

print('\nAvailable themes: ', style.theme_names())

print('\nSetting theme to new_theme')
style.theme_use('new_theme')

print('\nDisplaying theme "{0}" elements'.format(style.theme_use()))
print(style.element_names())

=================================================
Output
=================================================
Available themes:  ('clam', 'alt', 'default', 'classic')

Setting theme to default

Displaying theme "default" elements
('label', '', 'focus', 'treearea', 'separator', 'image', 'arrow',
'downarrow', 'Menubutton.indicator', 'Treeitem.row', 'vsash', 'text',
'sizegrip', 'indicator', 'Treeheading.cell', 'leftarrow', 'border',
'Radiobutton.indicator', 'hsash', 'vseparator', 'fill', 'thumb',
'background', 'uparrow', 'hseparator', 'trough', 'rightarrow',
'Treeitem.indicator', 'slider', 'field', 'pbar',
'Checkbutton.indicator', 'textarea', 'client', 'tab', 'padding')

Creating new theme

Available themes:  ('new_theme', 'clam', 'alt', 'default', 'classic')

Setting theme to new_theme

Displaying theme "new_theme" elements
()
===================================================
Output end
===================================================

Thanks in advance,
Pawel Mosakowski
Alexander Uvizhev | 8 Aug 16:59 2015
Picon

Text widget incorrect 'displaylines' count


Hi,
Recently I came across some strangeness in tkinter Text widget. I bind <Configure> event to it and the first
time I insert text into widget the callback is called and reports wrong 'displaylines' count.
Here is the code:
===
$ cat test_text.py
import tkinter

def check(event):
    lines = event.widget.count('1.0', 'end', 'displaylines')
    print(lines)

root = tkinter.Tk()
master = tkinter.Frame(master=root)
master.grid()
text = tkinter.Text(master=master, height=1)
text.bind('<Configure>', check)
text.grid()
text.insert('1.0', "1234567890")  # first time insert
text.insert('1.0', "1234567890")  # second
text.unbind('<Configure>')
master.mainloop()
===
Output:
$ python3 test_text.py 
(10,)

Is it what's supposed to be or some sort of bug?

--

-- 
Alexander Uvizhev
uvizhe <at> yandex.ru
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

--

-- 
boB
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

Gmane