[Tutor] curses delwin functionality?

2005-12-29 Thread Bernd Prager
Hi,

I'm trying to get my hands on some curses experiences in Python.

The examples I found don't really tell me how to get rid of subwindows and
restore the underlying window again. Is there something that replaces the
curses functionality "delwin"?
Thanks for any help!
Here's my example:

#!/usr/bin/python
import sys, curses

def sub(scrn):
s = curses.newwin(4, 30, 1, 1)
s.erase()
s.box()
s.addstr(1, 1, "sub window")
s.refresh()
s.getch()
# curses.delwin(s) <-- that doesn't exist :-/
scrn.refresh()

def main(scrn):
scrn = curses.initscr()
curses.curs_set(0)  # turn cursor off
scrn.erase()
scrn.addstr(2, 2, "press  to continue,  to quit");
while 1:
c = scrn.getch()
if c == curses.KEY_F12: sys.exit()
elif c == curses.KEY_F1: sub(scrn)

# main loop
if __name__ == '__main__':
curses.wrapper(main)
sys.exit()


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


Re: [Tutor] curses delwin functionality?

2005-12-29 Thread Bernd Prager
> Rumor has it that Bernd Prager may have mentioned these words:
>
> [snippety]
>
>> # curses.delwin(s) <-- that doesn't exist :-/
>
> I've *only* done curses in python, so quite often I don't know the C
> analogue, but try:
>
> curses.endwin()
>
I am looking for a functionality that destroys only a single subwindow
created with curses.newwin so that the underlying area can get restored
again.
curses.endwin() terminates the curses main screen, right?

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


Re: [Tutor] Please help!!

2006-05-19 Thread Bernd Prager
Hey Matata,

>From the website  http://www.boddie.org.uk/python/HTML.html:

import urllib
# Get a file-like object for the Python Web site's home page.
f = urllib.urlopen("http://www.python.org";)
# Read from the object, storing the page's contents in 's'.
s = f.read()
f.close()


Hope this helps,
-- Bernd

MATATA EMMANUEL wrote:
>
> Hi there,
>
> I'm tasked to write a Paython script which is supposed to hit a web
> site and download a shapefile from that web site. I don't have any
> clue and would like your help. I use 9.x if this matter.
>
> Thank you.
>
> Matt.
>
>  
> 
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>   

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


[Tutor] question about mpmath product expression

2009-02-02 Thread Bernd Prager
Does anybody know if there is a precision difference when I use mpmath and
take an expression:

from mpmath import *
mp.dps = 100
mu0 = [mpf('4') * pi * power(10, -7)

rather then:

mu0 = fprod([mpf('4'), pi, power(10, -7)])

?

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