IDLE edit windows ignores tab settings

2005-02-17 Thread Lith
[Python/IDLE newbie here]

I created a .py file in UltraEdit and saved it. I use (and always will,
despite the FAQ's recommendation against it) tabs instead of spaces,
set to 4 spaces per tab.

When I open the file in IDLE, suddenly the tabs are 8 spaces wide. This
is despite the fact that I've gone to
Options menu > Configure IDLE... > Fonts/Tabs
and set it thusly:
Tab key inserts tabs
indent width 4

Is this a bug, or am I missing something?

I'll now go google to see who to blame for the original 8-space tab.

-- 
http://mail.python.org/mailman/listinfo/python-list


Hello File.py

2005-02-18 Thread Lith

Here's a simple script, where I want to use a GUI to select a file.
(And eventually do something interesting with it.) Some problems
appear.

(1) Why does it call MenuOpen automatically?

(2) Why won't it open when I choose the menu item?

(3) Python Cookbook gave me the sys.exit call, if I run it from IDLE it
gives me a traceback. Should I be using something else?

(4) Does tkFileDialog have any useful official documentation? The main
google results for it don't even give the possible parameters for the
function calls, or sample code showing how to use.

(5) Is the 'parent = parent,' line just plain wrong?

Feel free to note any horrors you see.


..

import sys
from Tkinter import *
import tkFileDialog

def MenuOpen(parent):
tkFileDialog.askopenfilename(
defaultextension= '.ctb',
filetypes   = [
('AutoCAD Color-Dependent Style Table Files', '*.ctb'),
('AutoCAD Named Style Table Files', '*.stb'),
('All Files', '*.*')
  ],
initialdir  = 'Desktop',
initialfile = '',
parent  = parent,
title   = 'Open Plot Style File...'
)


def DoInterface():
root= Tk()

menubar = Menu(root)
root.config(menu = menubar)

menuFile= Menu(menubar)
menuFile.add_command(   label='Open',
command=MenuOpen(parent=root))
menuFile.add_separator()
menuFile.add_command(   label='Exit', command=sys.exit)

menubar.add_cascade(label='File', menu=menuFile);

root.mainloop()

#

DoInterface()

-- 
http://mail.python.org/mailman/listinfo/python-list