'Tuple object is not callable'

ignore the comments before GRIDLINES = (. I am trying to make a tuple of start point and end points but it keeps the tuple can not be called on. I don’t know why and I would like some help.
1CELL_SIZE = 200 # This may be adjusted, depending on screen resolution
2
3 # Gridlines, two vertical and two horizontal, in (begin, end) format
4 GRIDLINES = (
5 (
6 (-CELL_SIZE/2, CELL_SIZE3/2), # start point
7 (-CELL_SIZE/2, -CELL_SIZE
3/2) # end point
8 )
9 (
10 (CELL_SIZE/2, CELL_SIZE3/2), # start point
11 (CELL_SIZE/2, -CELL_SIZE
3/2) # end point
12 )
13 (
14 (-CELL_SIZE3/2, CELL_SIZE/2), # start point
15 (CELL_SIZE
3/2, CELL_SIZE/2) # end point
16 )
17 (
18 (-CELL_SIZE3/2, -CELL_SIZE/2), # start point
19 (CELL_SIZE
3/2, -CELL_SIZE/2) # end point
20 )
21 )

This is the original code. I am trying to put it into a for loop but gridlines can not be called on making it impossible.
VERT_LEFT = (
(-CELL_SIZE/2, CELL_SIZE3/2), # start point
(-CELL_SIZE/2, -CELL_SIZE
3/2) # end point
)
VERT_RIGHT = (
(CELL_SIZE/2, CELL_SIZE3/2), # start point
(CELL_SIZE/2, -CELL_SIZE
3/2) # end point
)
HORZ_TOP = (
(-CELL_SIZE3/2, CELL_SIZE/2), # start point
(CELL_SIZE
3/2, CELL_SIZE/2) # end point
)
HORZ_BOTTOM = (
(-CELL_SIZE3/2, -CELL_SIZE/2), # start point
(CELL_SIZE
3/2, -CELL_SIZE/2) # end point
)

Hi Bovan,

You have consecutive parentheses, without commas between them:

(
   (-CELL_SIZE/2, CELL_SIZE*3/2),   # start point
   (-CELL_SIZE/2, -CELL_SIZE*3/2)   # end point
)
( ...

Parens are used for both grouping and calling objects, so Python reads
this as if you had said:

(1, 2)(...)

which is a function call on a tuple.

In other words, you need to be more careful in your use of parentheses
and commas.

By the way, you also have a lot of unnecessary recalculations of
CELL_SIZE/2 in various combinations. Aside from being annoying to read,
it’s also inefficient. If this were my code, I would totally use a
temporary variable:

x = CELL_SIZE/2
GRIDLINES = (
    (-x, 3*x),
    (-x, -3*x),
    (x, -3*x),
    (x, 3*x),
    # etc
    )
2 Likes