Cursor Location

2005-10-20 Thread Samantha
Is there any code that would allow a person to click a location on the 
screen and have that location saved for a future use? For example to imbed a 
watermark on an image or text, etc.

S 


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


Cursor Position.

2005-11-08 Thread Samantha
Looking at the goto(xy) thread.
Is there a way to get the X,Y position from a cursor click and then use the 
position to apply something like a water mark on an image at that position?
Thanks,


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


Re: Cursor Position.

2005-11-08 Thread Samantha
I will be using Tkinter. All I need is a way to get the X,Y position from a 
mouse click. I am trying to have an image loaded to click on, but that seems 
to be a problem. So if I can just get the position from the screen of a 
graphics program, showing an image, it will work for me.
S
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "Samantha" <[EMAIL PROTECTED]> wrote:
>
>> Looking at the goto(xy) thread.
>> Is there a way to get the X,Y position from a cursor click and then use 
>> the
>> position to apply something like a water mark on an image at that 
>> position?
>
> All GUI toolkits can handle the "click here" part.  Which one are you 
> using ?
>
> to apply water marks, use PIL:
>
>http://www.pythonware.com/products/pil
>
> 
>
>
> 


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


Re: Cursor Position.

2005-11-09 Thread Samantha
Diez,
> Won't be easy - a toolkit (like tkinter) will only capture your mouse 
> events that are directed towards it's own windows.

That is my exact problem. I want to have the mouse event captured from 
another application window. In this case an image window opened in Paint 
Shop Pro that by the way uses Python to make scripts. I would like to be 
able to click on the image and get the X,Y positions. I have been able to 
get the X,Y from Tkinter own window as you say. Once I have those positions 
I can use them in a Paint Shop Pro script.
Thanks for your reply. Do you have any advise as to how I can do what I am 
trying or is it, in a practical matter, impossible.
S

"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Samantha wrote:
>> I will be using Tkinter. All I need is a way to get the X,Y position from 
>> a mouse click. I am trying to have an image loaded to click on, but that 
>> seems to be a problem. So if I can just get the position from the screen 
>> of a graphics program, showing an image, it will work for me.
>
> Won't be easy - a toolkit (like tkinter) will only cpature your mous 
> events that are directed towards it's own windows. You might be able to 
> convince your program to collect mouse-events outside for a short period 
> of time - like snapshot programs do - but that will reqiure pretty 
> complicated, OS-dependant coding. Certainly way more complicated than 
> loading an image using tkinter. Better tell us what's giving you a hard 
> time there.
>
> Diez 


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


Print to Windows default Printer

2005-01-18 Thread Samantha
I am new to Python and I am having considerable trouble trying to print 
(using a simple script) to the default printer rather than the screen.
Thanks for any help.
S 


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


Re: Print to Windows default Printer

2005-01-18 Thread Samantha
Thanks for he quick response. This is small sample code from a PSP script to 
get Exit Info of a digital image. I want to print to the printer rather than 
the screen.
---
Info = App.Do( Environment, 'ReturnImageInfo' )

print
print 'Input Device Information'
for key in InputDeviceKeys:
if OnlyExistingData == 0 or Info[key] != '':
print key, ': ', Info[key]
print

print 'Artist Information'
for key in ArtistKeys:
if OnlyExistingData == 0 or Info[key] != '':
print key, ': ', Info[key]
print
--
Is there an easy way to do it. Right now I  copy and paste to a txt file 
then print the file?
S

"Peter Hansen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Samantha wrote:
>> I am new to Python and I am having considerable trouble trying to print 
>> (using a simple script) to the default printer rather than the screen.
>> Thanks for any help.
>
> Please show some example code, and explain in more detail
> what you are trying to do.  There are perhaps *dozens*
> of different ways to do printing under Windows, and we
> can't guess which approach you are trying, nor which
> might be suitable for your needs.
>
> -Peter 


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


Re: Print to Windows default Printer

2005-01-19 Thread Samantha
Thanks Tim. I didn't realize it would be so difficult.
S

"Tim Golden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED] 


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


Re: Print to Windows default Printer

2005-01-20 Thread Samantha
Thanks Tim,
That is exactly what I want to do.
How do I map the printer to LPT1?
S
"Tim Golden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> [Samantha]
> | Thanks Tim. I didn't realize it would be so difficult.
> | S
>
> Strictly, if all you want to do is print text and you
> have mapped LPTx: to some printer (local or network)
> then the venerable "PRINT " or "COPY  LPTx:"
> may well be what you want. You can issue these via
> an os.system call from within Python, and if that serves
> the purpose, well...
>
> 
>
> import os
>
> f = open ("temp.txt", "w")
> f.write ("""I must go down to the sea again,
> To the lonely sea and the sky.
> And all I ask is a tall ship
> And a star to steer her by.
> """)
> f.close ()
>
> os.system ("print temp.txt")
>
> 
>
> TJG
>
> 
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
>  


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


Re: Print to Windows default Printer

2005-01-20 Thread Samantha
The printer is on LPT1, but I sure can't get the temp file to print for some 
reason.
I am using Windows XP SP2.
S
"Tim Golden" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> [Samantha]
>
> [... snip my explanation of PRINT / COPY LPTx: ...]
>
> | Thanks Tim,
> | That is exactly what I want to do.
> | How do I map the printer to LPT1?
> | S
>
> Depends on a lot of things: whether the printer is
> local or networked; what version of Windows you're
> running, &.
>
> As a very basic starting point: if it's a local printer
> (ie plugged into the back of your machine) it's probably
> on LPT1: already, or you could go to the Add Printer
> wizard and tell it to configure it for LPT1: there.
>
> If it's networked, then something like:
>
> NET USE LPT1: \\servername\printerqueue
>
> should achieve the right effect.
>
> TJG
>
> 
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
>  


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


Re: Print to Windows default Printer

2005-01-20 Thread Samantha
Thanks Scott,
Not wasting any paper yet. I can't seem to get the file to print at all yet.
S
"Scott David Daniels" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Tim Golden wrote:
>> [Samantha]
>> | I am new to Python and I am having considerable trouble | trying to 
>> print | (using a simple script) to the default printer rather than the 
>> screen.
>> | Thanks for any help.
>> | S It may be that something here will help you:
>>
>> http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html
>>
>> Specifically, I think that the section print raw text is
>> closest to what you're asking (although not necessarily
>> to what you'll eventually want):
>>
>> http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html#win32print
>>
> You might be interested in using PDFCreator to save paper during
> your tests.  It is a windows printer driver that creates a PDF file:
>
> http://sourceforge.net/projects/pdfcreator/
>
> --Scott David Daniels
> [EMAIL PROTECTED] 


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


Re: Print to Windows default Printer

2005-01-20 Thread Samantha
Thanks for the URL. I finally am able to print the temp file. Not exactly 
what I wanted, but it will work. The code I used to print was this:

os.system ("start /min notepad /P temp.txt")

Thanks ALL!
S
"Kristian Zoerhoff" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Thu, 20 Jan 2005 19:14:10 -, Tim Golden
> <[EMAIL PROTECTED]> wrote:
>> [Kristian Zoerhoff]
>> |
>> | On Thu, 20 Jan 2005 18:58:25 -, Tim Golden
>> | <[EMAIL PROTECTED]> wrote:
>> | >
>> | > Can anyone else try a "PRINT blah" or a "COPY blah LPT1:"
>> | > on XP SP2?
>> |
>> | The printer is probably connected via USB, not the parallel port
>> | (LPT1), so the above won't work. I googled, and found some sage advice
>> | here:
>> |
>> | http://www.winnetmag.com/Article/ArticleID/39674/39674.html
>> |
>> | that may assist the OP.


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


Probably over my head... Trying to get Font Names

2005-02-17 Thread Samantha
I am attempting to extract the Font Names from the installed windows fonts. 
I am having a heck of a time getting these rather than the file names. 
Examples can be seen by going to Control Panel > Fonts

Any help or direction is appreciated.
S 


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


Re: Probably over my head... Trying to get Font Names

2005-02-17 Thread Samantha
Thanks Mike. I must have not installed the ttfquery and font tools 
correctly. I get an error. This error:

Traceback (most recent call last):
  File "C:\Python24\Lib\font-getter.py", line 1, in -toplevel-
from ttfquery import _scriptregistry
  File "C:\Python24\Lib\site-packages\ttfquery\_scriptregistry.py", line 1, 
in -toplevel-
from ttfquery import ttffiles
  File "C:\Python24\Lib\site-packages\ttfquery\ttffiles.py", line 10, 
in -toplevel-
from ttfquery import describe, findsystem
  File "C:\Python24\Lib\site-packages\ttfquery\describe.py", line 2, 
in -toplevel-
from fontTools import ttLib
ImportError: No module named fontTools

Like I said I think I am way in over my short head.
S
"Mike C. Fletcher" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> If you don't have a GUI library to use, TTFQuery+Fonttools will retrieve 
> this information:
>
> from ttfquery import _scriptregistry
> fonts = _scriptregistry.registry.fonts.keys()
> fonts.sort()
> for name in fonts:
>print name
>
> if you do have a GUI, your GUI library will almost certainly have a 
> mechanism to retrieve the list of fonts.  With wxPython, for instance, 
> it's called wxFontEnumerator.  If you just want the user to choose a font, 
> most GUI libraries already have controls/dialogues that can handle it.
>
> TTFQuery is going out, reading the .ttf fonts with Fonttools and storing 
> their metadata in an index for faster access, whereas your GUI library 
> will be using a simple API call to retrieve the metadata.  That means 
> TTFQuery is going to be heavier, but it can, for instance, also give you 
> information about fonts not installed on the system.
>
> HTH,
> Mike
>
> TTFQuery:
>http://ttfquery.sourceforge.net/
>
>
> Samantha wrote:
>
>>I am attempting to extract the Font Names from the installed windows 
>>fonts. I am having a heck of a time getting these rather than the file 
>>names. Examples can be seen by going to Control Panel > Fonts
>>
>>Any help or direction is appreciated.
>>S
> 
>  Mike C. Fletcher
>  Designer, VR Plumber, Coder
>  http://www.vrplumber.com
>  http://blog.vrplumber.com
>  PyCon is coming...
> 


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


Re: Probably over my head... Trying to get Font Names

2005-02-18 Thread Samantha
Mike,
Not sure why that email bounced.
I downloaded these files:
WinTTX2.0b1.exe
TTFQuery-1.0.0.win32.exe
numarray-1.1.1.win32-py2.4.exe

They all seemed to install. Is WinTTX2.0b1.exe not the fontTools file?
S

"Mike C. Fletcher" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> [Samantha: your email has been bouncing, might want to clear your inbox]
>
> Samantha wrote:
>
>>Thanks Mike. I must have not installed the ttfquery and font tools 
>>correctly. I get an error. This error:
>>
> ...
>
>>ImportError: No module named fontTools
>>
>>Like I said I think I am way in over my short head.
>>S
>>
> Does look as though you missed getting FontTools installed.  You realise
> it's a separate package from TTFQuery, right?
>
>http://sourceforge.net/projects/fonttools/
>
> You'll have to do the standard:
>
>python setup.py install
>
> to get it installed on your system.
>
> HTH,
> Mike
>
> 
>  Mike C. Fletcher
>  Designer, VR Plumber, Coder
>  http://www.vrplumber.com
>  http://blog.vrplumber.com
>  PyCon is coming...
>
> 


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


Re: Trying to get Font Names

2005-02-18 Thread Samantha
Thanks Fredrik,
The Tkinter method didn't give any results but using PIL did. I'll have to 
play with it a little.
Thanks again,
S
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "Samantha" <[EMAIL PROTECTED]> wrote:
>


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


Re: Probably over my head... Trying to get Font Names

2005-02-18 Thread Samantha
Mike,
Strange Hotmail.
I'll start over with the installs and you are correct on it being Numpy. I 
got the wrong file.
I'll give it a go and let you know.
Thanks
S
"Mike C. Fletcher" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Samantha wrote:
>


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


Re: Probably over my head... Trying to get Font Names

2005-02-18 Thread Samantha
Thank you Pierre, that worked. I am still going to try and get the 
TTFQuery+Fonttools to work just out of curiosity.
Thanks again to everyone!!!
S

"Pierre Quentel" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "Samantha" <[EMAIL PROTECTED]> wrote in message 
> news:<[EMAIL PROTECTED]>...
>> I am attempting to extract the Font Names from the installed windows 
>> fonts.
>> I am having a heck of a time getting these rather than the file names.
>> Examples can be seen by going to Control Panel > Fonts
>>
>> Any help or direction is appreciated.
>> S
>
> Try this :
>
> Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on 
> win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from Tkinter import Tk
>>>> import tkFont
>>>> root=Tk()
>>>> print tkFont.families(root) 


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


Re: Probably over my head... Trying to get Font Names

2005-02-19 Thread Samantha
Mike I did get the last msg. Still trying to get things under control.
S
"Mike C. Fletcher" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Samantha wrote:
>
>>Mike,
>>Not sure why that email bounced.
>>
> That last one bounced too, btw.
>
>>I downloaded these files:
>>WinTTX2.0b1.exe
>>TTFQuery-1.0.0.win32.exe
>>numarray-1.1.1.win32-py2.4.exe
>>
>>They all seemed to install. Is WinTTX2.0b1.exe not the fontTools file?
>>
> I believe WinTTX is a font-editing program from which fontTools was split 
> out into a separate project.
>
> As well, though I don't *know* that this will cause problems, I'd thought 
> fontTools required Numeric (Numpy) rather than Numarray.  Would try the 
> fontTools package first with the Numarray you've installed, and if you 
> then find problems with it not being able to find Numeric, install the 
> Numpy release.
>
> HTH,
> Mike
>
> 
>  Mike C. Fletcher
>  Designer, VR Plumber, Coder
>  http://www.vrplumber.com
>  http://blog.vrplumber.com
>  PyCon is coming...
> 


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


Output File

2005-02-24 Thread Samantha
Is there a limit on the size of the file Python will read then output. I am 
reading a file of 433 lines and when I output the same file it only will 
output 421 lines. The last line is cut off also. This is the code I am using 
as a test.

input = open(r'C:\Documents and Settings\Owner\Desktop\somefile.html','r')
L = input.readlines()
input.close

output = open(r'C:\Documents and 
Settings\Owner\Desktop\somefile_test.html','w')
for t in range(len(L)):
 output.writelines(L[t])
output.close

Also is there a way to test for EOF in Python?
Thanks
S 


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


Re: Output File

2005-02-24 Thread Samantha
Thanks Steve. Appreciate it!
S
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Samantha wrote:
>> input = open(r'C:\Documents and 
>> Settings\Owner\Desktop\somefile.html','r')
>> L = input.readlines()
>> input.close
>>
>> output = open(r'C:\Documents and 
>> Settings\Owner\Desktop\somefile_test.html','w')
>> for t in range(len(L)):
>>  output.writelines(L[t])
>> output.close
>
> I think you want to do [1]:
>
> input = open(r'somefile.html', 'r')
> lst = input.readlines()
> input.close() # note the () -- this is a method call
>
> output = open(r'somefile_test.html', 'w')
> output.writelines(lst) # not in a for-loop
> output.close() # note the () -- this is a method call
>
> If you really want to use a for-loop, the code should look like:
>
> for line in L:
> output.write(line)
>
> If you call writelines when you only want to write one line, you're going 
> to get odd behavior -- Python's going to interpret each character in your 
> line as a "line" itself.
>
>> Also is there a way to test for EOF in Python?
>
> file.read() or file.readline() will return '' if you have reached the end 
> of the file.
>
> STeVe
>
> [1] In fact, what you really probably want to do is to take advantage of 
> the fact that a file is an iterator.  You can write:
>
> input = open(r'somefile.html', 'r')
> output = open(r'somefile_test.html', 'w')
> output.writelines(input)
>
> And the lines of somefile.html will be written to somefile_test.html. You 
> might also look at the shutil module. 


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


Re: very simple tkinter demo program

2005-04-09 Thread Samantha
I can not get it to run.
S
"max(01)*" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> hello.
>
> i wrote a very simple tkinter demo program that uses menus, buttons, 
> labels, entries, frames and secondary toplevels.
>
> it is a python version of a java program made by a colleague.
>
> the user can create ("Scrivi") a record with his second name, first name 
> and date of birth, save ("Salva") the record to a file or read in 
> ("Leggi") a previously created file. "Annulla" is to cancel. "Chiudi" is 
> to close.
>
> i also used try-except for checking for invalid files.
>
> only one menu is real ("File"), the others are for future use.
>
> i'd like to hear your suggestions and comments for improving it.
>
> i recently learned tkiner from stephen ferg's website and reading the 
> tk8.4 widget demo programs.
>
> one thing i still cannot do is to make the primary window and the 
> secondary aware of each other (so avoid that a second instance of a 
> secondary window can be generated if an instance still exists, for 
> example).
>
> so, here it is folks:
>
> ---cut here---
>
> from Tkinter import *
>
> class MiaApp:
>   def __init__(self, genitore):
>
> self.MioGenitore = genitore
>
> fonte = ("Helvetica", "12")
>
> self.campi = ["Cognome", "Nome" , "Data di nascita"]
>
> quadro_grande = Frame(genitore)
> quadro_grande.pack(expand = YES, fill = BOTH)
>
> quadro_menu = Frame(quadro_grande)
> quadro_menu.configure(
>   bd = 1,
>   relief = RAISED
>   )
> quadro_menu.pack(side = TOP, fill = X)
>
> pm_file = Menubutton(quadro_menu)
> pm_file.configure(text = "File")
> pm_file.pack(side = LEFT)
>
> m_file = Menu(pm_file)
> pm_file.configure(menu = m_file)
> m_file.configure(tearoff = NO)
> m_file.add_command(
>   label = "Scrivi",
>   command = self.premuto_scrivi
>   )
> m_file.add_command(
>   label = "Leggi",
>   command = self.premuto_leggi
>   )
> m_file.add_separator()
> m_file.add_command(
>   label = "Chiudi",
>   command = genitore.destroy
>   )
>
> pm_mod = Menubutton(quadro_menu)
> pm_mod.configure(text = "Modifica")
> pm_mod.pack(side = LEFT)
>
> pm_aiuto = Menubutton(quadro_menu)
> pm_aiuto.configure(text = "?")
> pm_aiuto.pack(side = RIGHT)
>
> msg = Label(quadro_grande)
> msg.configure(
>   font = fonte,
>   relief = RIDGE,
>   wraplength = "10c",
>   justify = LEFT,
>   text = u"Questo \u00E8 un programma in Python \
> che trae ispirazione da un analogo lavoro del collega \
> G. Renda. Il programma originale era scritto \
> in linguaggio Java, e sfruttava le librerie JFC \
> (\u00ABJava Foundation Class\u00BB, dette anche \
> \u00ABSwing\u00BB); questo invece usa le librerie Tk, \
> mediante il modulo Tkinter."
>   )
> msg.pack(
>   side = TOP,
>   padx = "2m",
>   pady = "2m"
>   )
>
> quadro_pulsanti = Frame(quadro_grande)
> quadro_pulsanti.pack(
>   side = BOTTOM,
>   fill = X,
>   padx = "2m",
>   pady = "2m"
>   )
>
> scrivi = Button(quadro_pulsanti)
> scrivi.configure(
>   text = "Scrivi",
>   command = self.premuto_scrivi
>   )
> scrivi.pack(side = LEFT, expand = YES)
>
> leggi = Button(quadro_pulsanti)
> leggi.configure(text = "Leggi", command = self.premuto_leggi)
> leggi.pack(side = LEFT, expand = YES)
>
> chiudi = Button(quadro_pulsanti)
> chiudi.configure(text = "Chiudi", command = genitore.destroy)
> chiudi.pack(side = LEFT, expand = YES)
>
>   def premuto_scrivi(self):
> InserimentoRecord()
>
>   def premuto_leggi(self):
> ConsultazioneRecord()
>
> class InserimentoRecord(Toplevel):
>   def __init__(self):
>
> Toplevel.__init__(self)
>
> self.titolo = "Inserimento"
> self.wm_title(self.titolo)
>
> quadro_grande = Frame(self)
> quadro_grande.pack(expand = YES, fill = BOTH)
>
> self.quadro_pulsanti = Frame(quadro_grande)
> self.quadro_pulsanti.pack(
>   side = BOTTOM,
>   fill = X,
>   padx = "2m",
>   pady = "2m"
>   )
>
> quadri_ing = []
> self.n = len(miaApp.campi)
> self.var = []
> eti = []
> larg_eti = max(map(len, miaApp.campi))
> ing = []
> for i in range(self.n):
>   quadri_ing.append(None)
>   self.var.append(None)
>   ing.append(None)
>   eti.append(None)
>   quadri_ing[i] = Frame(quadro_grande)
>   quadri_ing[i].pack(side = TOP, expand = YES, fill = BOTH)
>   self.var[i] = StringVar()
>   eti[i] = Label(quadri_ing[i])
>   eti[i].configure(
> text = miaApp.campi[i] + ": ",
> width = larg_eti,
> anchor = E
> )
>   eti[i].pack(side = LEFT, pady = 5, padx = 10, fill = X)
>   ing[i] = Entry(quadri_ing[i], textvariable = self.var[i])
>   ing[i].pack(side = LEFT, pady = 5, padx = 10, fill = X)
>
> self.salva = Button(self.quadro_pulsanti)
> self.salva.configure(

Re: very simple tkinter demo program

2005-04-10 Thread Samantha
Thanks that worked.
S
"max(01)*" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Samantha wrote:
>> I can not get it to run.
>> S
>
> sorry about that. baybe it is a conflict between tabstop width in my 
> editor and in my newsreader.
>
> i substituted tabs with spaces and i hope now you can run it.
>
> bye
>
> macs
>
> cuthere
>
> from Tkinter import *
>
> class MiaApp:
>   def __init__(self, genitore):
>
> self.MioGenitore = genitore
>
> fonte = ("Helvetica", "12")
>
> self.campi = ["Cognome", "Nome" , "Data di nascita"]
>
> quadro_grande = Frame(genitore)
> quadro_grande.pack(expand = YES, fill = BOTH)
>
> quadro_menu = Frame(quadro_grande)
> quadro_menu.configure(
>   bd = 1,
>   relief = RAISED
>   )
> quadro_menu.pack(side = TOP, fill = X)
>
> pm_file = Menubutton(quadro_menu)
> pm_file.configure(text = "File")
> pm_file.pack(side = LEFT)
>
> m_file = Menu(pm_file)
> pm_file.configure(menu = m_file)
> m_file.configure(tearoff = NO)
> m_file.add_command(
>   label = "Scrivi",
>   command = self.premuto_scrivi
>   )
> m_file.add_command(
>   label = "Leggi",
>   command = self.premuto_leggi
>   )
> m_file.add_separator()
> m_file.add_command(
>   label = "Chiudi",
>   command = genitore.destroy
>   )
>
> pm_mod = Menubutton(quadro_menu)
> pm_mod.configure(text = "Modifica")
> pm_mod.pack(side = LEFT)
>
> pm_aiuto = Menubutton(quadro_menu)
> pm_aiuto.configure(text = "?")
> pm_aiuto.pack(side = RIGHT)
>
> msg = Label(quadro_grande)
> msg.configure(
>   font = fonte,
>   relief = RIDGE,
>   wraplength = "10c",
>   justify = LEFT,
>   text = u"Questo \u00E8 un programma in Python \
> che trae ispirazione da un analogo lavoro del collega \
> G. Renda. Il programma originale era scritto \
> in linguaggio Java, e sfruttava le librerie JFC \
> (\u00ABJava Foundation Class\u00BB, dette anche \
> \u00ABSwing\u00BB); questo invece usa le librerie Tk, \
> mediante il modulo Tkinter."
>   )
> msg.pack(
>   side = TOP,
>   padx = "2m",
>   pady = "2m"
>   )
>
> quadro_pulsanti = Frame(quadro_grande)
> quadro_pulsanti.pack(
>   side = BOTTOM,
>   fill = X,
>   padx = "2m",
>   pady = "2m"
>   )
>
> scrivi = Button(quadro_pulsanti)
> scrivi.configure(
>   text = "Scrivi",
>   command = self.premuto_scrivi
>   )
> scrivi.pack(side = LEFT, expand = YES)
>
> leggi = Button(quadro_pulsanti)
> leggi.configure(text = "Leggi", command = self.premuto_leggi)
> leggi.pack(side = LEFT, expand = YES)
>
> chiudi = Button(quadro_pulsanti)
> chiudi.configure(text = "Chiudi", command = genitore.destroy)
> chiudi.pack(side = LEFT, expand = YES)
>
>   def premuto_scrivi(self):
> InserimentoRecord()
>
>   def premuto_leggi(self):
> ConsultazioneRecord()
>
> class InserimentoRecord(Toplevel):
>   def __init__(self):
>
> Toplevel.__init__(self)
>
> self.titolo = "Inserimento"
> self.wm_title(self.titolo)
>
> quadro_grande = Frame(self)
> quadro_grande.pack(expand = YES, fill = BOTH)
>
> self.quadro_pulsanti = Frame(quadro_grande)
> self.quadro_pulsanti.pack(
>   side = BOTTOM,
>   fill = X,
>   padx = "2m",
>   pady = "2m"
>   )
>
> quadri_ing = []
> self.n = len(miaApp.campi)
> self.var = []
> eti = []
> larg_eti = max(map(len, miaApp.campi))
> ing = []
> for i in range(self.n):
>   quadri_ing.append(None)
>   self.var.append(None)
>   ing.append(None)
>   eti.append(None)
>   quadri_ing[i] = Frame(quadro_grande)
>   quadri_ing[i].pack(side = TOP, expand = YES, fill = BOTH)
>   self.var[i] = StringVar()
>   eti[i] = Label(quadri_ing[i])
>   eti[i].configure(
> text = miaApp.campi[i] + ": ",
> width = larg_eti,
> anchor = E
> )
>   eti[i].pack(side = LEFT, pady = 5, padx = 10, fill = X)
>   ing[i] = Entry(quadri_ing[i], textvariable = self.var[i])
>   ing[i].pack(side = LEFT, pady = 5, padx = 10, fill = X)
>
> self.salva = Button(sel

Writing to Registry

2006-11-16 Thread Samantha
I am working with this recipes:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66011

The problem I am having is setting a hex value.
This line ---   SetValueEx(aKey,"MyNewKey",0, REG_SZ, 
r"c:\winnt\explorer.exe")
I want something Like --   SetValueEx(aKey,"MyNewSize",0, REG_SZ, 120 or 
some value)
Help would be appreciated.
S


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


Re: Writing to Registry

2006-11-16 Thread Samantha
Thanks for the link.
S
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> At Thursday 16/11/2006 20:48, Samantha wrote:
>
>>I am working with this recipes:
>>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66011
>>
>>The problem I am having is setting a hex value.
>>This line ---   SetValueEx(aKey,"MyNewKey",0, REG_SZ,
>>r"c:\winnt\explorer.exe")
>>I want something Like --   SetValueEx(aKey,"MyNewSize",0, REG_SZ, 120 or
>>some value)
>
> Usually when you don't know how to use a certain function, you begin by 
> reading the documentation for it:
> http://docs.python.org/lib/module--winreg.html#l2h-5827
>
>
> -- 
> Gabriel Genellina
> Softlab SRL
> __
> Correo Yahoo!
> Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu 
> cuenta ya! - http://correo.yahoo.com.ar 


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

Re: Writing to Registry

2006-11-17 Thread Samantha
That was the fix.
S

"Mark Elston" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Note:  this is untested (since I don't like screwing around
> in the registry...)
>
> Have you tried using REG_DWORD?
>
> Mark
>> 


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


Re: merits of Lisp vs Python

2006-12-08 Thread samantha
What are you? A pointy haired boss?

- s

Bjoern Schliessmann wrote:
> Alex Mizrahi wrote:
>
> > hell no, lisp's syntax is much easier than python's since it's
> > homogenous
>
> Can you give an example? I cannot imagine how homogenity always
> results in easiness.
>
> > (and certainly lisp was invented much 30 years before
> > Python, so that's Python uses Lisp features)
>
> I think you acknowledged that the syntax is different and not
> borrowed?
>
> [many parentheses]
> > that make logic more explicit
>
> Can you give an example?
>
> Regards,
>
>
> Björn
> 
> Xpost cll,clp
> 
> -- 
> BOFH excuse #166:
> 
> /pub/lunch

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


Help with display placement

2006-04-04 Thread Samantha
I am new to Python and am attempting to write a routine that will display a 
five game selection for a power ball drawing. I think I have the random 
drawing set to work ok, but I want to have the dialog box move in the center 
of my screen. I can't seem to get the code correct to do this. Any help 
would be appreciated.
Thanks,
S
This is the routine I have.
###

import random
from Tkinter import *
root = Tk()


frame = Label(root, width=50, height=2, background = 'white', text = 
'PowerBall Numbers')
frame.pack()

def GetNumbers():

numbers = random.sample(xrange(53), 5)
numbers.sort()
numbers[0] = numbers[0] + 1

numbers[1] = numbers[1] + 1

numbers[2] = numbers[2] + 1

numbers[3] = numbers[3] + 1

numbers[4] = numbers[4] + 1
powerball = random.sample(xrange(42), 1)
powerball[0] = powerball[0] + 1

return numbers, powerball

y = 0
sp1 = sp2 = sp3 = sp4 = sp5 ='   '
w = 0
for x in range(5):
 y = y + 1
 MyNumbers= GetNumbers()
 x = MyNumbers

 num1= str(x[0][0])

 num2 = str(x[0][1])

 num3 = str(x[0][2])

 num4 = str(x[0][3])

 num5 = str(x[0][4])

 pbnum = str(MyNumbers[1][0])

 root.title =('Powerball Numbers')
 w = Label(root, width=50, height=2, background= 'white' ,  text='Game 
'+str(y)+': Numbers: '+num1.zfill(2)+'  '+num2.zfill(2)+'  '+num3.zfill(2)+' 
'+num4.zfill(2)+'  '+num5.zfill(2)+'  '+'PowerBall: '+pbnum.zfill(2))
 w.pack()

root.mainloop()

# 


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


Re: Help with display placement

2006-04-04 Thread Samantha
I want to be able to control where the dialog is displayed .  X,Y location 
from the upper left corner of the screen.
S
<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> This code come up, fairly centered in my screen.  What do you mean by
> move?
> 


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


Re: Help with display placement

2006-04-04 Thread Samantha
Thanks, think I have it now.
S
<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Ok so I'm not to bright sometimes
>
> Well if you want this kinda control I suggest you go ahead and subclass
> toplevel, but the simple answer before running
>
> root.mainloop()
>
>
> make a call to
>
> root.geometry(geometryString)
>
>
>
> geoometrystring is in the format WxH+X+Y  - you may hve to do some
> screen calcs first to get the right numbers.  ie "50x100+50+50" create
> a  50pix by 100 pix window offset 50 from the top and 50 from the left.
>
> To my mind, better to subclass toplevel and set everything in there -
> but's mostly stylistic preference for something this simple.
>
> And while I'm making suggestions ;)  Try wxPython.  I used tKinter for
> about 3 months before tossing it in frustration when I wanted to do
> somtheing "slick" , but I have a lot of fondness for some quick and
> dirty UI's I did in tKinter a ways back.
> 


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