From: Nick Buchholz on
On Tue, 10 Aug 2010 10:58:39 -0400
John(a)mail.python.org wrote:
>Thank you both for the suggestions. Have you ever tried to make one?
>--
>http://mail.python.org/mailman/listinfo/python-list
I don't know if my first reply went out so I'll repeat
Here is a list box dialog written to allow selection of one of a specific type of file. It is a
method in a larger gui object that controls hardware on a remote machine (called a PAN) and loads
commands from files.
def modeFiles(self):
try:
sysFile = self.chkConnected()
except Disconnect,e:
return (False, '')

self.pan.ppxGetAVP( ('modeFdir', ) )
dir = self.pan.avps['modeFdir'].get()

fileList = fetchModFiles(self.pan, dir=dir)
flist = []
for file in fileList:
idx = rfind(file, '/')
flist.append(file[idx+1:])


dlg = Pmw.ComboBoxDialog(self.parent, title = 'Mode File Select',
buttons=('Load', 'Cancel'), defaultbutton='Load',
combobox_labelpos=N, label_text='Which Mode file to load',
scrolledlist_items=flist, listbox_width=32)
dlg.geometry('240x300+30+250')
dlg.tkraise()
result = dlg.activate(geometry='240x300+30+250')

if result == 'Load':
print "loading %s/%s "%(dir, dlg.get())
self.pan.ppxSetMode( (dlg.get(),) )
else:
print "leaving"
here is fetchModFilesz
def fetchModFiles(pan=None, dir=None):
""" A function to read mod files on remote pan in directory dir """
fileList = []
if pan is not None:
if dir is None:
rCmd = "/bin/echo $MONSOON_HOME"
dir = commands.getoutput("ssh -X -l monsoon %s '%s'" % (pan.panName, rCmd) )
dir = dir+os.sep+'_'+pan.sysName

lsCmd = "/bin/ls %s/*.mod"%(dir,)
resp = commands.getoutput("ssh -X -l monsoon %s '%s'"% (pan.panName, lsCmd))
fileList = resp.split("\n")
else:
pass
return fileList

Someday I may have time to go back and clean these up and generalize them. But as the only
software guy on a 3 man-year project due to complete in 9 months quick and dirty is the rule.

Nick
nbuchholz(a)noao.edu
Day phone: (520) 318-8203
"Time is an illusion, Lunchtime doubly so" - Ford Prefect
Time is an illusion perpetrated by the manufacturers of space.

From: John on
On Tue, 10 Aug 2010 09:20:31 -0700 (PDT), Jeff Hobbs
<jeff.hobbs(a)gmail.com> wrote:

>On Aug 9, 9:53�pm, John wrote:
>> As a learning exercise in Tkinter I htought about making a very simple
>> and basic file manager for my own use. I tried searching google for
>> any sample project and could not find anything. Not exactly �sure how
>> to start I tought I could ask here?
>>
>> I thought about making two listboxes one to list folders only the
>> other files inside. I tried to make one listbox first but did not know
>> how to list folders only.
>
>Filter with os.path.isdir()
>
>> Is there a way to list folders with images?
>> Any suggestions or help how to proced would be appreciated.
>
>If you are using a Tkinter with Ttk (Tk 8.5), then use the treeview
>widget:
>
>http://docs.activestate.com/activepython/3.1/python/library/tkinter.ttk.html
>
>For more advanced needs, there is a Tk extension called tktreectrl
>that does some very cool views and has lots of controls:
>
>http://tktreectrl.sourceforge.net/
>
>Jeff

My python is version 2.6.5. Would you recomend I upgrade and if yes
to which version?


from tkinter import ttk

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from tkinter import ttk
ImportError: No module named tkinter
From: Jeff Hobbs on
On Aug 10, 9:43 am, John wrote:
> On Tue, 10 Aug 2010 09:20:31 -0700 (PDT), Jeff  Hobbs
>
>
>
> <jeff.ho...(a)gmail.com> wrote:
> >On Aug 9, 9:53 pm, John wrote:
> >> As a learning exercise in Tkinter I htought about making a very simple
> >> and basic file manager for my own use. I tried searching google for
> >> any sample project and could not find anything. Not exactly  sure how
> >> to start I tought I could ask here?
>
> >> I thought about making two listboxes one to list folders only the
> >> other files inside. I tried to make one listbox first but did not know
> >> how to list folders only.
>
> >Filter with os.path.isdir()
>
> >> Is there a way to list folders with images?
> >> Any suggestions or help how to proced would be appreciated.
>
> >If you are using a Tkinter with Ttk (Tk 8.5), then use the treeview
> >widget:
>
> >http://docs.activestate.com/activepython/3.1/python/library/tkinter.t...
>
> >For more advanced needs, there is a Tk extension called tktreectrl
> >that does some very cool views and has lots of controls:
>
> >http://tktreectrl.sourceforge.net/
>
> >Jeff
>
> My python is version 2.6.5.  Would you recomend I upgrade and if yes
> to which version?

The version of python really isn't tightly coupled to the version of
Tk, it is the configuration of how that python is built. ActivePython
builds with Tk 8.5, so if you are using that, and it is < v3.1 (where
ttk is in the core), then just do:
pypm install pyttk
which will install the wrapper you need for Ttk into v2.6 or 2.7
python. You need to make sure that you have Tk 8.5 (Tkinter.TkVersion
>= 8.5) for ttk to work (though not technically true, the 8.4 tile
version has subtle differences). The core python distro is still
using the older Tk 8.4 in stock installers iiuc.

Jeff
From: John on
On Tue, 10 Aug 2010 14:51:14 -0700 (PDT), Jeff Hobbs
<jeff.hobbs(a)gmail.com> wrote:

>On Aug 10, 9:43�am, John wrote:
>> On Tue, 10 Aug 2010 09:20:31 -0700 (PDT), Jeff �Hobbs
>>
>>
>>
>> <jeff.ho...(a)gmail.com> wrote:
>> >On Aug 9, 9:53�pm, John wrote:
>> >> As a learning exercise in Tkinter I htought about making a very simple
>> >> and basic file manager for my own use. I tried searching google for
>> >> any sample project and could not find anything. Not exactly �sure how
>> >> to start I tought I could ask here?
>>
>> >> I thought about making two listboxes one to list folders only the
>> >> other files inside. I tried to make one listbox first but did not know
>> >> how to list folders only.
>>
>> >Filter with os.path.isdir()
>>
>> >> Is there a way to list folders with images?
>> >> Any suggestions or help how to proced would be appreciated.
>>
>> >If you are using a Tkinter with Ttk (Tk 8.5), then use the treeview
>> >widget:
>>
>> >http://docs.activestate.com/activepython/3.1/python/library/tkinter.t...
>>
>> >For more advanced needs, there is a Tk extension called tktreectrl
>> >that does some very cool views and has lots of controls:
>>
>> >http://tktreectrl.sourceforge.net/
>>
>> >Jeff
>>
>> My python is version 2.6.5. �Would you recomend I upgrade and if yes
>> to which version?
>
>The version of python really isn't tightly coupled to the version of
>Tk, it is the configuration of how that python is built. ActivePython
>builds with Tk 8.5, so if you are using that, and it is < v3.1 (where
>ttk is in the core), then just do:
> pypm install pyttk
>which will install the wrapper you need for Ttk into v2.6 or 2.7
>python. You need to make sure that you have Tk 8.5 (Tkinter.TkVersion
>>= 8.5) for ttk to work (though not technically true, the 8.4 tile
>version has subtle differences). The core python distro is still
>using the older Tk 8.4 in stock installers iiuc.
>
>Jeff

My version is from python.org can I upgrade my version to 8.5?

tia for all the help much appreciated.
From: Eric Brunel on
In article <770366ta10gk98vgd5n2tapl7ag6skaeaj(a)4ax.com>, John wrote:
> My python is version 2.6.5. Would you recomend I upgrade and if yes
> to which version?
>
>
> from tkinter import ttk
>
> Traceback (most recent call last):
> File "<pyshell#0>", line 1, in <module>
> from tkinter import ttk
> ImportError: No module named tkinter

On Python 2.x, the module is called Tkinter with an uppercase T. It has
been changed to tkinter with a lowercase t in Python 3.x for naming
consistency reasons.