is there any Python code for spatial tessellation?
thanks a lot!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ax + by = c.)
Plus the intersection coordinates of the two perpendicular bisectors:
x,y
On 10/8/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Sat, 8 Oct 2005, Shi Mu wrote:
>
> > is there any Python code for spatial tessellation?
>
> Are you looking for cod
There are four points with coordinates:
2,3;4,9;1,6;3,10.
How to use Python to draw one perpendicular bisector between (2,3) and (4,9);
the other perpendicular bisector between (1,6)和(3,10);
then, makes the output like:
l1 a b c
l2 a b c
(Note: l indicates the perpendicular bisector with equation a
After I run the following python code, I expect to have the printing such as:
The year is 2005
However, I got something like:
The year is 2005
Fri Oct 14 17:43:31 2005
Fri Oct 14 17:43:31 2005
The year is 2005
What is the reason?
The code follows:
import time
import now
class today(now.now):
return time.ctime(self.t)
def __repr__(self):
return time.ctime(self.t)
def __call__(self,t=-1.0):
if t < 0.0:
self.t = time.time()
else:
self.t = t
self.storetime()
On 10/14/05, Kent Johnson <[EMAIL PROTECTED]> wro
I have installed Python 2.3 and I type "help()" and then "Keywords".
I get a list of words. And it says that I can enter any of the words
to get more help. I enter
"and" and I get the following error message:
"Sorry, topic and keyword documentation is not available because the Python
HTML document
what is the difference between index and find in the module of string?
for both "find" and "index", I got the position of the letter.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
what does %25f mean?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I typed:
landUse = {'res': 1, 'com': 2, 'ind': 3, "other" :[4,5,6,7]}
and when i checked landUse, I found it become:
{'ind': 3, 'res': 1, 'other': [4, 5, 6, 7], 'com': 2}
why the order is changed?
___
Tutor maillist - Tutor@python.org
http://mail.python
what does the following sentence mean? does it mean i can not use
double-quoted string?
SyntaxError: EOL while scanning single-quoted string
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I got confused by the following information from the help for "FIND":
find(s, *args)
find(s, sub [,start [,end]]) -> in
what does *args mean (especially the '*')?
also, in the sub, why put a comma before start?
what does 'in' mean?
___
Tutor maillist
Is there any difference if I remove the '/'
from the following statement?
intMatrix2 = [[1,1,2,4,1,7,1,7,6,9],\
[1,2,5,3,9,1,1,1,9,1],\
[0,0,5,1,1,1,9,7,7,7]]
print intMatrix2
I removed one '\' and it still works.
So what is the use of '\'?
I got confused by the following information from the help for "FIND":
find(s, *args)
find(s, sub [,start [,end]]) -> in
what does *args mean (especially the '*')?
also, in the sub, why put a comma before start?
what does 'in' mean?
___
Tutor maillis
I can not understand the use of "cell in row" for two times in the code:
# convert the matrix to a 1D list
matrix = [[13,2,3,4,5],[0,10,6,0,0],[7,0,0,0,9]]
items = [cell for row in matrix for cell in row]
print items
___
Tutor maillist - Tutor@python.o
When I run the following code,
script kept running and I have to force it to stop.
Could you check the code to give suggestions how to improve it?
Thanks a lot!
from Tkinter import *
from Tkinter import _cnfmerge
class Dialog(Widget):
def __init__(self, master=None, cnf={}, **kw):
cnf = _
> wrote:
> What kind of improvement you looking for?
>
> On 10/29/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> > When I run the following code,
> > script kept running and I have to force it to stop.
> > Could you check the code to give suggestions how to improve i
What does this line 11 mean in the following code?
1 # calc.py
2 def calc(seq):
3 maximum = 0
4 max_item = []
5 for i in seq:
6 product = (i[0]*100 + i[1]*10 + i[2]) * (i[3]*10 + i[4])
7 if product > maximum:
8maximum = product
9max_ite
what does pack mean in the following code?
# File: hello1.py
from Tkinter import *
root = Tk()
w = Label(root, text="Hello, world!")
w.pack()
root.mainloop()
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
eometry manager is "grid"
>
> If you don't specify anything, the widget will simply not be displayed..
> see here:
>
> http://effbot.org/tkinterbook/pack.htm
>
>
> Hugo
>
> Shi Mu wrote:
> > what does pack mean in the following code?
>
o
> > have it displayed with the current geometry manager(which per default is
> > the pack method)
> >
> > A geometry manager is just a way for arranging widgets into a window.
> > Another geometry manager is "grid"
> >
> > If you don't spe
It is very hard for me to understand why we need the following line?
if __name__ == "__main__":
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
why the following code report error?
"""
Is given point in polygon?
"""
def pointInPoly(point, pointsList):
"Return True if point is contained in polygon (defined by
given list of points.)"
assert len(pointsList) >= 3, 'Not enough points to define a
polygon (I require 3 or more.)
why the following code does not work?
# determine if a point is inside a given polygon or not
# Polygon is a list of (x,y) pairs.
def point_inside_polygon(x,y,poly):
n = len(poly)
inside =False
p1x,p1y = poly[0]
for i in range(n+1):
p2x,p2y = poly[i % n]
if y > m
why the following code does not work?
"""
Tkinter Color Vector Objects
Just the bare minimum to create re-sizable
and re-usable color icons in tkinter.
"""
import Tkinter as Tk
import math
""" Get points for a unit regular-polygon with n sides. """
def getregpoly(sides):
points = []
ang
just return the
"Simple pointInPoly() test..."
no return from point_inside_polygon(3,10,poly)
On 11/6/05, Glen Wheeler <[EMAIL PROTECTED]> wrote:
> > why the following code does not work?
> > [snip script]
>
> Give us an error message, please.
> ___
> T
nformation -
>
> If there's an error message - copy and paste the error message
> If there is no error message - tell us what you expected to happen,
> and what happened instead.
>
> Regards,
>
> Liam Clarke
> On 11/7/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> >
Is there any sample code to calculate the overlaid area between two polygons?
Thanks!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I have a list of random points:
[[x0,y0],[x1,y1],...,[xn,yn]]
how can I use Tkinter to draw lines to connect them one by one based
on the order in the list?
Thanks a lot!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tuto
I tried to write the follwoing code to draw lines on the anvas based
on the clicked points but retur the message:
>>> Traceback (most recent call last):
File "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
global lastX, lastY
if lastX != "":
c.create_line(lastX,lastY,event.x,event.y,fill="white")
lastX = event.x
lastY = event.y
frame = c
c.bind('',click)
c.pack()
root.mainloop()
On 11/6/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
> Hi Shi Mu,
>
uot;)
lastX = event.x
lastY = event.y
c.bind('',click)
c.pack()
root.mainloop()
On 11/6/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> based on the following rewritten code, why the lines still can not be
> drawn? (there is no error report and the canvas appears).
>
> f
frame = c needs to be put before the click function or the lines can
not be drawn.
On 11/6/05, Chris F.A. Johnson <[EMAIL PROTECTED]> wrote:
> On Sun, 6 Nov 2005, Shi Mu wrote:
>
> > based on the following rewritten code, why the lines still can not be
> > drawn? (there is
when I read some python sample codes.
I found that several of them need "python -i" to run them or you will
not get any result though the program does not report any error.
I really can not understand it.
Thanks!
___
Tutor maillist - Tutor@python.org
ht
why the follwoing code report the error:
Traceback (most recent call last):
File "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Python23\Examples\AppB\text.py", line 24, in ?
text.image_creat
Danny,
You are right.
Thanks for your great patience and kindness.
Shi
On 11/7/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> > it works now.
>
> Hi Shi Mu,
>
> Can you describe how you fixed it? The only diff between the two programs
> that I see is that yo
any python code for middle school geometry teaching use?
for instance, calculate the polygon area size, overlaid area size?
Thanks.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Because i am also teaching some introduction courses of programming in
middle school, I prefer some 2D geometry codes.
On 11/7/05, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote:
>
> | any python code for middle school geometry teaching use?
> | for instance, calculate the polygon area size, ove
any python module to calculate sin, cos, arctan?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
any code to draw parabola or curve?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
is there any sample code of triangulation? many thanks!
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
using python to do Fortune's sweeping
line algorithm. Is python is not good in doing that kind of
computation or some other reason?
Thanks a lot for all of your responses!!!
On 11/9/05, Gregor Lingl <[EMAIL PROTECTED]> wrote:
>
>
> Alex Hunsley schrieb:
> > Shi Mu wrote
I see. maybe some websites are blocked to me.
On 11/10/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
> Hi Shi Mu,
>
> There are some direct ways you can find a delaunay triangulation
> implementation in Python. In fact, the first Google hit to "triangulation
> python&q
what is the difference between the two ways of assigning the list?
p=a vs. p=a[:]
>>> a=range(5)
>>> a
[0, 1, 2, 3, 4]
>>> p=a
>>> p
[0, 1, 2, 3, 4]
>>> p=a[:]
>>> p
[0, 1, 2, 3, 4]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/li
thanks!
On 11/10/05, Liam Clarke <[EMAIL PROTECTED]> wrote:
> Hi Shi,
>
> For what you're doing, nothing at all.
>
> When you use a colon, slice syntax, it defaults to [start:end] so p =
> a[:] is the same as
> p = a[0:len(a)]
>
> Regards,
>
> Liam Clar
thanks!
On 11/11/05, Gregor Lingl <[EMAIL PROTECTED]> wrote:
> Liam Clarke schrieb:
>
> >Hi Shi,
> >
> >For what you're doing, nothing at all.
> >
> >When you use a colon, slice syntax, it defaults to [start:end] so p =
> >a[:] is the same as
> >p = a[0:len(a)]
> >
> >
> >
> But in fact there is a
On 11/11/05, Eric Walker <[EMAIL PROTECTED]> wrote:
> All,
> I have a dictionary say:
> d = {'first':[]}
> I am going through another list and depending on whats going on,
> I want to add to the empty list. I have tried the following to noavail.
>
> d['first'] = d['first'].append("string")
>
> I wo
I got the output as:
>>>
Yes!!! This line will always print
from the code:
try:
fsock = open("c:/TEMP/hello.txt")
except IOError:
print "The file does not exist, exiting gracefully"
print "Yes!!! This line will always print"
it means the code found there is hello.txt,
why it does not show
On 11/12/05, Liam Clarke <[EMAIL PROTECTED]> wrote:
> Sorry Shi Mu, don't understand the question.
>
> So, you're successfull opening a file. Now, you need to read it
>
> for line in fsock:
>print line
>
> or
>
> fsockData = fsock.read()
>
>
On 11/12/05, Danny Yoo <[EMAIL PROTECTED]> wrote:
> > > So, you're successfull opening a file. Now, you need to read it
> > >
> > > for line in fsock:
> > >print line
> > >
> > > Have a play with those.
> > it works! thank
efully"
> > > > print "Yes!!! This line will always print"
>
> > I thought if the except situation does not happen, that means the try
> > section works. At that time, I was a little confused that since the open
> > statement works, why there is nothing s
I have a code here. I understand i can not draw lines without the
global definition of lastX and lastY. But still confused by its use.
when should we use global definition?
from Tkinter import *
root = Tk()
c = Canvas(root, bg='#0e2e0e', height=500, width=1000)
frame = c
lastX=""
lastY=""
def cl
51 matches
Mail list logo