[Tutor] A Newbie Printing Question

2005-03-29 Thread Richard Lyons
I have little experience with programming.  I have Python installed on a 
 Windows XP system.  What code do I need to use to send output from a 
Python script to a local printer attached to my workstation?  to a 
network printer?

Any help would be appreciated.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Can't find MSVCR71.dll

2005-04-06 Thread Richard Lyons
I tried to install the win32all.exe to work with Python 2.4.1 on a 
Windows XP machine.  Didn't work.  I got the following error message:

This application has failed to start because MSVCR71.dll was not found.
From what I've found by way of Google, this is a common problem.  What 
is the work around.

After getting the error I installed Python 2.3.5 and win32all.exe for 
2.3 and everything seems to be working fine, but I would really like to 
work with the later version

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Improving printouts from IDLE

2005-06-27 Thread Richard Lyons
Given the difficulties that I've found trying to print from Python, I 
was just commenting this week-end on the efficiency of the printing 
process used in IDLE.

What is the specific code that allows the IDLE window to be printed to 
notepad (in Windows XP)?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python and Tkinter (total newbie)

2011-12-09 Thread Richard Lyons

I have tried to enter the first sample program from p. 19 in Grayson:
Python and Tkinter Programming.  When I run the program I get an error
as follows:

Traceback (most recent call last):
 File "/home/dick/Desktop/calc1.py", line 50, in 
   if _name_ == '_main_':
NameError: name '_name_' is not defined

The error makes sense because nowhere in the code is _main_ defined.
How do I fix this?


from Tkinter import *
def frame(root, side):
   w = Frame(root)
   w.pack(side=side, expand=Yes, fill=BOTH)
   return w

def button(root, side, text, command=NONE):
   w = Button(root, text+text, command+command)
   w.pack(side=side, expand=YES, fill=BOTH)
   return w

class Calculator(Frame) :
   def _init_(self) :
   Frame._init_(self)
   self.pack(expand=YES, fill=BOTH)
   self.master.title('Simple Calculator')
   self.master.iconname("calc1")

   diplay = StringVar()
   Entry(self, relief=SUNKEN,
 textvariable=display).pack(
side=TOP, expand=YES,
fill=BOTH)

   for key in ("123", "456", "789", "-0."):
   keyF = frame(self, TOP)
   for char in key:
   button(keyF, LEFT, char,
  lambda w=display,s='%s'%char: w.set(w.get()+s))


   opsF = frame(self, TOP)
   for char in "+-*/=":
   if char == '=':
   btn = button(opsF, LEFT, char)
   btn.bind('',
lambda e, s=self, w=display: s.calc(w), '+')
   else:
   btn = button(opsF, LEFT, char,
   lambda w=display, c=char: w.set(w.get()+' '+c+' '))

   clearF = frame(self, BOTTOM)
   button(clearF, LEFT, 'Clr', lambda w=display: w.set(' '))

   def calc(self, display):
   try:
   display,set('eval(display.get())')
   except ValueError:
   display.set("ERROR")

if _name_ == '_main_':
   Calculator().mainloop()
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor