Hi,
I saw this line of code on a recent post:
a1[:] = [x*3 for x in a1]
Could somebody tells me what the [:] means? I can't find it anywhere.
See context below if needed:
On Dec 26, 4:46 pm, Tim Chase wrote:
> > What does *not* work is
> > 3 * [0,1,2]
> > As you know, this gives
> >
I tested the following code and wanted to make oval 2 become red after
I hit the enter key but though the code did not report error, it did
not change.
from Tkinter import *
root=Tk()
canvas=Canvas(root,width=100,height=100)
canvas.pack()
canvas.create_oval(10,10,20,20,tags='oval1',fill='blue')
can
On 12/4/05, Peter Otten <[EMAIL PROTECTED]> wrote:
> Ben Bush wrote:
>
> > On 12/4/05, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> >> Ben Bush wrote:
> >> > I tested the following code and wanted to get the message of "oval2
> >> > go
'd take it on you to consult the documentation as I asked you
> to do, I'm pretty sure you find the proper attribute.
>
>
> Regards,
>
> Diez
> --
> http://mail.python.org/mailman/listinfo/python-list
>
thanks anyway. The python manual for event is very brief and it is
hard for me to understand.
--
Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
On 12/4/05, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> Ben Bush wrote:
> > I tested the following code and wanted to get the message of "oval2
> > got hit" if I click the red one. But I always got "oval1 got hit".
> > from Tkinter import *
> &
I tested the following code and wanted to get the message of "oval2
got hit" if I click the red one. But I always got "oval1 got hit".
from Tkinter import *
root=Tk()
canvas=Canvas(root,width=100,height=100)
canvas.pack()
a=canvas.create_oval(10,10,20,20,tags='oval1',fill='blue')
b=canvas.create_ov
When I read python Manuel, I got confused by the following code:
def turnRed(self, event):
event.widget["activeforeground"] = "red"
self.button.bind("", self.turnRed)
I can not understand it.
--
http://mail.python.org/mailman/listinfo/python-list
On 11/22/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> "Ben Bush" wrote:
>
> > This question just came to my mind and not assigned by anyone.
>
> given that you and "Shi Mu" are asking identical questions, and that
> you've both started to send
On 11/23/05, Magnus Lycka <[EMAIL PROTECTED]> wrote:
> Ben Bush wrote:
> > I had the following code and when I clicked the left mouse button one
> > time. I got green line and the second click got a purple line and the
> > green disappeared.
> > I was confused by
On 11/22/05, Ben Bush <[EMAIL PROTECTED]> wrote:
> On 11/22/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > >>> ll = [[1,2],[2,1],[3,1],[1,4],[3,3],[1,4]]
> > >>> ls = [frozenset(i) for i in ll]
> > >>> ss = set(ls)
> > >
I had the following code and when I clicked the left mouse button one
time. I got green line and the second click got a purple line and the
green disappeared.
I was confused by two questions:
First, Clicknum increases when every time I click the button. Is it
possible to reset Clicknum to 0?
Second
On 11/22/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >>> ll = [[1,2],[2,1],[3,1],[1,4],[3,3],[1,4]]
> >>> ls = [frozenset(i) for i in ll]
> >>> ss = set(ls)
> >>> ss
> set([frozenset([1, 3]), frozenset([1, 2]), frozenset([1, 4]), frozenset([3])])
> >>> [list(i) for i in ss]
> [[1, 3], [1, 2]
On 11/22/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Ben Bush wrote:
>
> > I have a lis:
> > [[1,3],[3,4],[5,6],[8,9],[14,0],[15,8]]
> > I want a code to test when the difference between the first element in
> > the list of list is equal to or larger than 6,
On 11/22/05, Ben Bush <[EMAIL PROTECTED]> wrote:
> I have a list:
> [[1,2],[2,1],[3,1],[1,4],[3,3],[1,4]]
> How to remove all the duplicate or same after sorted from the lists?
> That is, [1,2] and [2,1] are the same after sorting them.
> I want the result to be:
> [[1,
I have a lis:
[[1,3],[3,4],[5,6],[8,9],[14,0],[15,8]]
I want a code to test when the difference between the first element in
the list of list is equal to or larger than 6, then move the previous
lists to the end of the list. that is:
[[14,0],[15,8],[1,3],[3,4],[5,6],[8,9]]
--
http://mail.python.or
I have a list:
[[1,2],[2,1],[3,1],[1,4],[3,3],[1,4]]
How to remove all the duplicate or same after sorted from the lists?
That is, [1,2] and [2,1] are the same after sorting them.
I want the result to be:
[[1,2],[3,1],[1,4],[3,3]]
--
http://mail.python.org/mailman/listinfo/python-list
On 11/21/05, Steve Juranich <[EMAIL PROTECTED]> wrote:
On 11/17/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> why subtract 1 from max_y - original_y?Because in the computer science world we like starting to count at 0.image_size = 1000original_y = 25 # Really the 26th pixel line.new_y = 1000 - 25 - 1 #
How to draw a dash line in the Tkinter?
--
http://mail.python.org/mailman/listinfo/python-list
I run the following code and the red line and black line show at the same time. is there anyway to show the red line first, then the black line? for example, after I click the 'enter' key?
from Tkinter import *tk = Tk()canvas = Canvas(tk, bg="white", bd=0, highlightthickness=0)canvas.pack(fill=BO
I wrote the following code to test the use of "try...exception",
and I want n to be printed out. However, the following code's output is:
Traceback (most recent call last): File "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript exec codeObject in _
Tkinter's coordinates setting are: the left upper corner is the smallest X and Y, which is different from our usual think that Y is largest in that location. If i draw some lines on the canvas and show some relationship among them, do I need transfer the coordinates?
--
http://mail.python.org/mail
On 11/15/05, Simon Brunning <[EMAIL PROTECTED]> wrote:
On 15/11/05, Ben Bush <[EMAIL PROTECTED]> wrote:> an error reported:
> Traceback (most recent call last):> File> "C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",> line 310,
rted:
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:\temp\try.py", line 8, in ?
from sets import Set as setImportError: cannot import name Set>>> -- Thanks!Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
On 11/15/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
Ben Bush said unto the world upon 2005-11-15 01:24:
>> Unfortunately, the indents got screwed up along the way. But the part>>>of my code you asked about was:>>>>for item in list1:>>if item in l
On 11/14/05, Ben Bush <[EMAIL PROTECTED]> wrote:
Hijacking Brian's response since my newsserver never god Ben's originalrequest...:I would program this at a reasonably high abstraction level, based on
sets -- since you say order doesn't matter, sets are more appropriateth
e condition
you wanted to test was never satisfied.Does that clarify it?Finally, your response to Alex would have been much more useful ifyou'd quoted the error rather than just asserting that you got anerror :-)
Best,Brian vdB-- Thanks!Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
n std) .
On 11/14/05, Ben Bush <
[EMAIL PROTECTED] > wrote:
When I run scripts in PythonWin,
sometimes will get the message of invalid syntax error.
How can I check which error I made?
For example, in VB, you might got the wrong place highlighted and help message too.
--
which IDE do you u
st2))) for i in range(len(intersection) - 1):
if intersection[i] == intersection[i+1] - 1: return True return FalseDuncan
Why it is potentially very expensive for large lists? what does intersection mean in Duncan's code? Thanks a lot for your
When I run scripts in PythonWin,
sometimes will get the message of invalid syntax error.
How can I check which error I made?
For example, in VB, you might got the wrong place highlighted and help message too.-- Thanks!Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
Hijacking Brian's response since my newsserver never god Ben's originalrequest...:I would program this at a reasonably high abstraction level, based on
sets -- since you say order doesn't matter, sets are more appropriatethan lists anyway. For example:def two_cont_in_common(x, y): common = set(
what does the following code mean?
if item in list2: if item + 1 in list1 and item + 1 in list2:
On 11/14/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
Ben Bush said unto the world upon 2005-11-14 05:51:> I have four lists:> lisA=[1,2,3,4,5,6,9]
> lis
or 6,5 so these comparison will return 1 but the comparison between lisD and lisA return 0.
-- Thanks!Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
to implement this in Tkinter?-- Thanks!Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
to implement this in Tkinter?-- Thanks!Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
Is there any package written in pure python code?
I know lots of packages borrow the functions from other languages such as C or FORTRAN. So it is still black box to me because I do not know these languages.
Ben
--
http://mail.python.org/mailman/listinfo/python-list
On 11/13/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
Ben Bush wrote:> When I click the button of cancel,> I got the follwoing message. I want to see "Goodbye" on the console screen.
> What to do?> KeyboardInterrupt: operation cancelled> num = input( "Enter a
On 11/12/05, Robert Kern <[EMAIL PROTECTED]> wrote:
Ben Bush wrote:> is there any code to decide whether a point is located within the circle> by three other points?
# Converted from my C++ code.# C.f. http://www.ics.uci.edu/~eppstein/junkyard/circumcenter.htmldef circumc
is there any code to decide whether a point is located within the circle by three other points?Thanks!B. Bush
--
http://mail.python.org/mailman/listinfo/python-list
Is there any pure python ocde there thoguh it is slow?
Not many people know C very well and it will be great to have some python code even for education use.
Ben
I know someone once mentioned that they tried writing one of theDelaunay triangulation algorithms in pure Python and abandoned it forbe
When I click the button of cancel,
I got the follwoing message. I want to see "Goodbye" on the console screen.What to do?
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
40 matches
Mail list logo