Nallo's Profile User Rating: -----

Reputation: 163 Stalwart
Group:
Contributors
Active Posts:
260 (0.12 per day)
Joined:
19-July 09
Profile Views:
9,269
Last Active:
User is offline Yesterday, 12:46 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
50
Icon   Nallo has not set their status

Posts I've Made

  1. In Topic: remeber previous iteration!

    Posted 3 May 2015

    Your problem is that you used a mutable object as a default argument.

    Run this to see what happens:
    def foo(n, bar = []):
        bar.append(n)
        return bar
    
    baz = foo(1)
    print(baz)
    baz = foo(2)
    print(baz)
    
    


    To avoid that:
    def foo(n, bar = None):
        if bar is None:
            bar = []
        bar.append(n)
        return bar
    
    baz = foo(1)
    print(baz)
    baz = foo(2)
    print(baz)
    
    
  2. In Topic: tkinter drawing rectangles

    Posted 2 Feb 2015

    create_rectangle takes four arguments plus some optional arguments. Those four arguments denote the position of the upper left and lower right corner: create_rectangle(x1, y1, x2, y2).
    What you did with the comented out self.canvas.create_rectangle(self.lst[i], 10, self.lst[i], 10) is create a rectangle for which the upper left and lower right corner are the same (no wonder you see no rectangle).

    An example:
    from Tkinter import *
    
    master = Tk()
    
    w = Canvas(master, width=200, height=100)
    w.pack()
    
    x, y = 10, 10
    width = 25
    width2 = 50
    height = 5
    dist = 10
    w.create_rectangle(x, y, x + width, y + height, outline='blue', fill="red")
    w.create_rectangle(x, y + height + dist, x + 50, y + height + dist + height) 
    
    mainloop()
    
    
  3. In Topic: Learning Python

    Posted 4 Jun 2014

    when you are writing
    x = Set([1, 3, 5, 7])
    print(x.union(Set([1, 4, 7])))
    
    

    other is Set([1, 4, 7]), so in the union fuction call in line
    for x in other:
    ...
    
    

    python tries to get an iterator over other ...
    ...python: thinking
    ...python: no __iter__ method defined
    ...python: oops, use some fallback
    ...not sure here, but python "does something" with __getitem__

    in other words:
    python needs an iterator to execute
    for x in other:
    
    

    but has some fallback if __iter__ is not provided for the other instance (again I am not sure about that fallback)
  4. In Topic: Help keeping track of attendees

    Posted 28 May 2014

    Edit: removed as was wrong
  5. In Topic: Help keeping track of attendees

    Posted 28 May 2014

    Why dont you just take the display() function from your first post ... you need to write the printdata function though.

My Information

Member Title:
D.I.C Regular
Age:
102 years old
Birthday:
January 1, 1913
Gender:
Programming Languages:
who cares

Contact Information

E-mail:
Private
Website URL:
Website URL  http://