giny28's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Members
Active Posts:
21 (0.07 per day)
Joined:
07-January 14
Profile Views:
129
Last Active:
User is offline Mar 13 2014 06:02 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   giny28 has not set their status

Posts I've Made

  1. In Topic: click and Boolean logic with tkinter

    Posted 12 Mar 2014

    Sorry :sweatdrop: , i found the answer , could you delete the last post ? I don't see where is the button 'Edit message ' ?
  2. In Topic: click and Boolean logic with tkinter

    Posted 12 Mar 2014

    Here is my code of the last exercise . I want to clarify that this is not a homework .The following exercise says :
    Modify the previous program so that it takes into account two successive clicks pourdéterminer the coordinates of the diagonal of the rectangle.

    I don't have any clue how to solve this ........

    >>> def manager(event) :
    ...     position(event)
    ...     draw(event)
    ...
    >>> def position(click) :
    ...     afficheur ['text'] = "%s, %s" % (click.x, click.y)
    ...
    >>> Listcolor = ('red', 'green','purple')
    >>> color = False
    >>> def draw(event):
    ...     global color
    ...     c = event.widget
    ...     d = 21
    ...     x, y = event.x, event.y
    ...     c.create_rectangle(x - d, y - d, x + d, y + d, fill=Listcolor[color], outline="")
    ...     color = not color
    ...
    >>> from Tkinter import *
    >>> top = Tk()
    >>> C = Canvas(top, width=400, height=400, bg="light yellow")
    >>> C.pack()
    >>> C.bind("<Button-1>", manager)
    '3075006548Lmanager'
    >>> afficheur = Label(top)
    >>> afficheur.pack()
    
  3. In Topic: click and Boolean logic with tkinter

    Posted 12 Mar 2014

    thanks ! :chinese:

    When i set colors[current_counter] with the selected index , i get the right square .

    Anyway, in your last code , it means that i have to forget the orginal function draw() ?

    Sorry , but i don't understand your comment "# this color COULD be assigned to your button now."
  4. In Topic: click and Boolean logic with tkinter

    Posted 12 Mar 2014

    I spend more that 2 weeks to think about this exercise , i don't think that this exercise is for my level in python . Why is so easy to get two colors and not 3 colors ?

    Thanks for your explanation :sorcerer:

    Yes , the counter always grows , also , tkinter is not easy for the beginner , it's like a chess game .... :dontgetit:
  5. In Topic: click and Boolean logic with tkinter

    Posted 12 Mar 2014

    :whatsthat: I put your code in my last code in the shell, but it always gives me a red square .
    i put in my function draw() : fill = colors[i%len(colors)], but the function selects only the firt color (red) !

    Do i have to place a global variable in my function draw() ?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

giny28 hasn't added any friends yet.

Comments

giny28 has no profile comments yet. Why not say hello?