I was wondering how to make more columns in this program in python. ''' from tkinter import * window = Tk()   nrows = 3 # X and O rows ncols = 3# X and O colums   bg_color = 'gray32' #Board Color label_font = ('Helvetica', '12', 'bold') message_font = ('Helvetica', '18', 'bold')   #get the images im_Empty = PhotoImage(file="brushwalker437b-128px.png") on_move_image = im_X = PhotoImage(file="hiclipart-com-X1-128px.png") off_move_image = im_O = PhotoImage(file="hiclipart-com-O1-128px.png")   square_width  = im_Empty.width() square_height = im_Empty.height()   # -------------------------------------------------------------------------------------- # Make a Frame with a border to contain the canvas # row = Frame(window, height=1, bd=8, relief=RAISED, bg=bg_color) row.pack(side=TOP, fill=X, padx=0, pady=0) # -------------------------------------------------------------------------------------- # Create the canvas and background image # canvas = Canvas(row, width = square_width, height = square_height,     bg = bg_color, bd=0, highlightthickness=0, relief='ridge') canvas.create_image(0, 0, image = im_Empty, anchor = 'nw')   canvas.update() canvas.pack()   #---------------------------------------------------------------------------------------- # Add a row at botom for label, button row = Frame(window, height=50, bd=4, relief=RAISED, bg=bg_color) row.pack(side=TOP, fill=X, padx=0, pady=0)   def new_game():     print('New Game')              #---------------------------------------------------------------------------------------- # New Game Button Button(row, fg ="white", bg = bg_color , text = "New Game", font=label_font,        command = new_game, height=1, bd=8, relief=RAISED).pack(side=LEFT, expand=NO, fill=X)   #---------------------------------------------------------------------------------------- # Message Label l_msg = Label(row, text = '', width=10, font=message_font, anchor=CENTER, height=1, bd=8,         relief=RAISED, bg=bg_color, fg='white', pady=0) l_msg.pack(side=LEFT, expand=YES, fill=X)   def on_mouse_press(event):     print('Mouse Pressed')   print('New Game')   canvas.bind('', on_mouse_press) window.title('Tic Tac Toe') window.mainloop()

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I was wondering how to make more columns in this program in python.

'''

from tkinter import *

window = Tk()

 

nrows = 3 # X and O rows

ncols = 3# X and O colums

 

bg_color = 'gray32' #Board Color

label_font = ('Helvetica', '12', 'bold')

message_font = ('Helvetica', '18', 'bold')

 

#get the images

im_Empty = PhotoImage(file="brushwalker437b-128px.png")

on_move_image = im_X = PhotoImage(file="hiclipart-com-X1-128px.png")

off_move_image = im_O = PhotoImage(file="hiclipart-com-O1-128px.png")

 

square_width  = im_Empty.width()

square_height = im_Empty.height()

 

# --------------------------------------------------------------------------------------

# Make a Frame with a border to contain the canvas

#

row = Frame(window, height=1, bd=8, relief=RAISED, bg=bg_color)

row.pack(side=TOP, fill=X, padx=0, pady=0)



# --------------------------------------------------------------------------------------

# Create the canvas and background image

#

canvas = Canvas(row, width = square_width, height = square_height,

    bg = bg_color, bd=0, highlightthickness=0, relief='ridge')

canvas.create_image(0, 0, image = im_Empty, anchor = 'nw')

 

canvas.update()

canvas.pack()

 

#----------------------------------------------------------------------------------------

# Add a row at botom for label, button

row = Frame(window, height=50, bd=4, relief=RAISED, bg=bg_color)

row.pack(side=TOP, fill=X, padx=0, pady=0)

 

def new_game():

    print('New Game')

            

#----------------------------------------------------------------------------------------

# New Game Button

Button(row, fg ="white", bg = bg_color , text = "New Game", font=label_font,

       command = new_game, height=1, bd=8, relief=RAISED).pack(side=LEFT, expand=NO, fill=X)

 

#----------------------------------------------------------------------------------------

# Message Label

l_msg = Label(row, text = '', width=10, font=message_font, anchor=CENTER, height=1, bd=8,

        relief=RAISED, bg=bg_color, fg='white', pady=0)

l_msg.pack(side=LEFT, expand=YES, fill=X)

 

def on_mouse_press(event):

    print('Mouse Pressed')

 

print('New Game')

 

canvas.bind('<Button-1>', on_mouse_press)

window.title('Tic Tac Toe')

window.mainloop()

 

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY