René's URL Explorer Experiment


Title: Build a Tic-Tac-Toe Game With Python and Tkinter – Real Python

Open Graph Title: Build a Tic-Tac-Toe Game With Python and Tkinter – Real Python

Description: In this step-by-step project, you'll learn how to create a tic-tac-toe game using Python and the Tkinter GUI framework. Tkinter is cross-platform and is available in the Python standard library. Creating a game in Python is a great and fun way to learn something new and exciting!

Open Graph Description: In this step-by-step project, you'll learn how to create a tic-tac-toe game using Python and the Tkinter GUI framework. Tkinter is cross-platform and is available in the Python standard library. Creating a game in Python is a great and fun way to learn something new and exciting!

Mail addresses
?subject=Python article for you&body=Build a Tic-Tac-Toe Game With Python and Tkinter on Real Python https://realpython.com/tic-tac-toe-python/

Opengraph URL: https://realpython.com/tic-tac-toe-python/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "Build a Tic-Tac-Toe Game With Python and Tkinter",
  "image": {
    "@type": "ImageObject",
    "url": "https://files.realpython.com/media/Make-a-Tic-Tac-Toe-Game-With-Python_Watermarked.b2c1e9e6d76b.jpg",
    "width": 1920,
    "height": 1080
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://realpython.com/tic-tac-toe-python/",
    "lastReviewed": "2025-02-01",
    "author": {
      "@type": "Person",
      "name": "Leodanis Pozo Ramos",
      "image": "https://realpython.com/cdn-cgi/image/width=862,height=862,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Perfil_final1.9f896bc212f6.jpg",
      "url": "https://realpython.com/team/lpozoramos/",
      "affiliation": {
        "@type": "Organization",
        "@id": "https://realpython.com/#organization",
        "name": "Real Python",
        "url": "https://realpython.com",
        "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
      }
    },
    "reviewedBy": [
      {
        "@type": "Person",
        "name": "Aldren Santos",
        "image": "https://realpython.com/cdn-cgi/image/width=500,height=500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Aldren_Santos_Real_Python.6b0861d8b841.png",
        "url": "https://realpython.com/team/asantos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Brenda Weleschuk",
        "image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
        "url": "https://realpython.com/team/bweleschuk/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Bartosz Zaczy\u0144ski",
        "image": "https://realpython.com/cdn-cgi/image/width=1694,height=1694,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/coders_lab_2109368.259b1599fbee.jpg",
        "url": "https://realpython.com/team/bzaczynski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "David Amos",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/me-small.f5f49f1c48e1.jpg",
        "url": "https://realpython.com/team/damos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Geir Arne Hjelle",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
        "url": "https://realpython.com/team/gahjelle/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Kate Finegan",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/VZxEtUor_400x400.7169c68e3950.jpg",
        "url": "https://realpython.com/team/kfinegan/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Mike Driscoll",
        "image": "https://realpython.com/cdn-cgi/image/width=900,height=900,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/mdriscoll.db44df0df864.jpg",
        "url": "https://realpython.com/team/mdriscoll/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Philipp Acsany",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/phi5_2.0e61b4c66f6b.jpg",
        "url": "https://realpython.com/team/pacsany/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      }
    ]
  },
  "datePublished": "2025-02-01T14:00:00+00:00",
  "dateModified": "2025-02-01T14:09:24.711176+00:00",
  "publisher": {
    "@type": "Organization",
    "@id": "https://realpython.com/#organization",
    "name": "Real Python",
    "url": "https://realpython.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
      "width": 512,
      "height": 512
    },
    "description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
    "slogan": "Become a Python Expert",
    "email": "info@realpython.com",
    "sameAs": [
      "https://github.com/realpython",
      "https://www.youtube.com/realpython",
      "https://twitter.com/realpython",
      "https://x.com/realpython",
      "https://www.linkedin.com/company/realpython-com/",
      "https://www.facebook.com/learnrealpython",
      "https://www.instagram.com/realpython",
      "https://www.tiktok.com/@realpython.com"
    ]
  },
  "author": {
    "@type": "Person",
    "name": "Leodanis Pozo Ramos",
    "image": "https://realpython.com/cdn-cgi/image/width=862,height=862,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Perfil_final1.9f896bc212f6.jpg",
    "url": "https://realpython.com/team/lpozoramos/",
    "affiliation": {
      "@type": "Organization",
      "@id": "https://realpython.com/#organization",
      "name": "Real Python",
      "url": "https://realpython.com",
      "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
    }
  },
  "description": "In this step-by-step project, you'll learn how to create a tic-tac-toe game using Python and the Tkinter GUI framework. Tkinter is cross-platform and is available in the Python standard library. Creating a game in Python is a great and fun way to learn something new and exciting!",
  "hasPart": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "How do you create a graphical user interface (GUI) for a tic-tac-toe game in Python?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "

You can create a graphical user interface (GUI) for a tic-tac-toe game using the Tkinter toolkit from the Python standard library. Tkinter allows you to build the game’s interface with windows, labels, and buttons to represent the game board and facilitate player interactions.

" } }, { "@type": "Question", "name": "How can you leverage the model-view-controller pattern when creating a tic-tac-toe game?", "acceptedAnswer": { "@type": "Answer", "text": "

In a tic-tac-toe game, the model-view-controller (MVC) pattern helps organize the code by separating the game’s logic (the model) from the user interface (the view), with the controller handling the interaction between the two. This pattern makes the code more maintainable and scalable.

" } }, { "@type": "Question", "name": "What are some ways you can extend a tic-tac-toe game development project?", "acceptedAnswer": { "@type": "Answer", "text": "

You can extend a basic tic-tac-toe game by allowing different board sizes, implementing a computer player with AI, or adding a scoring system to track multiple games. These enhancements can make the game more challenging and engaging for players.

" } } ] } }

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Make-a-Tic-Tac-Toe-Game-With-Python_Watermarked.b2c1e9e6d76b.jpg
og:imagehttps://files.realpython.com/media/Make-a-Tic-Tac-Toe-Game-With-Python_Watermarked.b2c1e9e6d76b.jpg
twitter:creator@realpython
og:typearticle

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/tic-tac-toe-python/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/tic-tac-toe-python/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Ftic-tac-toe-python%2F
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics
Intermediatehttps://realpython.com/search?level=intermediate
Advancedhttps://realpython.com/search?level=advanced
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/tic-tac-toe-python/#toc
Demo: A Tic-Tac-Toe Game in Pythonhttps://realpython.com/tic-tac-toe-python/#demo-a-tic-tac-toe-game-in-python
Project Overviewhttps://realpython.com/tic-tac-toe-python/#project-overview
Prerequisiteshttps://realpython.com/tic-tac-toe-python/#prerequisites
Step 1: Set Up the Tic-Tac-Toe Game Board With Tkinterhttps://realpython.com/tic-tac-toe-python/#step-1-set-up-the-tic-tac-toe-game-board-with-tkinter
Ensure the Right Tkinter Versionhttps://realpython.com/tic-tac-toe-python/#ensure-the-right-tkinter-version
Create a Class to Represent the Game Boardhttps://realpython.com/tic-tac-toe-python/#create-a-class-to-represent-the-game-board
Step 2: Set Up the Tic-Tac-Toe Game Logic in Pythonhttps://realpython.com/tic-tac-toe-python/#step-2-set-up-the-tic-tac-toe-game-logic-in-python
Define Classes for the Players and Their Moveshttps://realpython.com/tic-tac-toe-python/#define-classes-for-the-players-and-their-moves
Create a Class to Represent the Game Logichttps://realpython.com/tic-tac-toe-python/#create-a-class-to-represent-the-game-logic
Set Up the Abstract Game Boardhttps://realpython.com/tic-tac-toe-python/#set-up-the-abstract-game-board
Figure Out the Winning Combinationshttps://realpython.com/tic-tac-toe-python/#figure-out-the-winning-combinations
Step 3: Process the Players’ Moves on the Game’s Logichttps://realpython.com/tic-tac-toe-python/#step-3-process-the-players-moves-on-the-games-logic
Validate Players’ Moveshttps://realpython.com/tic-tac-toe-python/#validate-players-moves
Process Players’ Moves to Find a Winnerhttps://realpython.com/tic-tac-toe-python/#process-players-moves-to-find-a-winner
Check for Tied Gameshttps://realpython.com/tic-tac-toe-python/#check-for-tied-games
Toggle Players Between Turnshttps://realpython.com/tic-tac-toe-python/#toggle-players-between-turns
Step 4: Process Players’ Moves on the Game Boardhttps://realpython.com/tic-tac-toe-python/#step-4-process-players-moves-on-the-game-board
Handle a Player’s Move Eventhttps://realpython.com/tic-tac-toe-python/#handle-a-players-move-event
Update the Game Board to Reflect the Game Statehttps://realpython.com/tic-tac-toe-python/#update-the-game-board-to-reflect-the-game-state
Run Your Tic-Tac-Toe Game for the First Timehttps://realpython.com/tic-tac-toe-python/#run-your-tic-tac-toe-game-for-the-first-time
Step 5: Provide Options to Play Again and Exit the Gamehttps://realpython.com/tic-tac-toe-python/#step-5-provide-options-to-play-again-and-exit-the-game
Build the Game’s Main Menuhttps://realpython.com/tic-tac-toe-python/#build-the-games-main-menu
Implement the Play Again Optionhttps://realpython.com/tic-tac-toe-python/#implement-the-play-again-option
Conclusionhttps://realpython.com/tic-tac-toe-python/#conclusion
Frequently Asked Questionshttps://realpython.com/tic-tac-toe-python/#frequently-asked-questions
Next Stepshttps://realpython.com/tic-tac-toe-python/#next-steps
https://realpython.com/feedback/survey/article/tic-tac-toe-python/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/tic-tac-toe-python/disliked/?from=article-sidebar
Leodanis Pozo Ramoshttps://realpython.com/tic-tac-toe-python/#author
https://realpython.com/tic-tac-toe-python/#reader-comments
intermediatehttps://realpython.com/tutorials/intermediate/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
Demo: A Tic-Tac-Toe Game in Pythonhttps://realpython.com/tic-tac-toe-python/#demo-a-tic-tac-toe-game-in-python
Project Overviewhttps://realpython.com/tic-tac-toe-python/#project-overview
Prerequisiteshttps://realpython.com/tic-tac-toe-python/#prerequisites
Step 1: Set Up the Tic-Tac-Toe Game Board With Tkinterhttps://realpython.com/tic-tac-toe-python/#step-1-set-up-the-tic-tac-toe-game-board-with-tkinter
Ensure the Right Tkinter Versionhttps://realpython.com/tic-tac-toe-python/#ensure-the-right-tkinter-version
Create a Class to Represent the Game Boardhttps://realpython.com/tic-tac-toe-python/#create-a-class-to-represent-the-game-board
Step 2: Set Up the Tic-Tac-Toe Game Logic in Pythonhttps://realpython.com/tic-tac-toe-python/#step-2-set-up-the-tic-tac-toe-game-logic-in-python
Define Classes for the Players and Their Moveshttps://realpython.com/tic-tac-toe-python/#define-classes-for-the-players-and-their-moves
Create a Class to Represent the Game Logichttps://realpython.com/tic-tac-toe-python/#create-a-class-to-represent-the-game-logic
Set Up the Abstract Game Boardhttps://realpython.com/tic-tac-toe-python/#set-up-the-abstract-game-board
Figure Out the Winning Combinationshttps://realpython.com/tic-tac-toe-python/#figure-out-the-winning-combinations
Step 3: Process the Players’ Moves on the Game’s Logichttps://realpython.com/tic-tac-toe-python/#step-3-process-the-players-moves-on-the-games-logic
Validate Players’ Moveshttps://realpython.com/tic-tac-toe-python/#validate-players-moves
Process Players’ Moves to Find a Winnerhttps://realpython.com/tic-tac-toe-python/#process-players-moves-to-find-a-winner
Check for Tied Gameshttps://realpython.com/tic-tac-toe-python/#check-for-tied-games
Toggle Players Between Turnshttps://realpython.com/tic-tac-toe-python/#toggle-players-between-turns
Step 4: Process Players’ Moves on the Game Boardhttps://realpython.com/tic-tac-toe-python/#step-4-process-players-moves-on-the-game-board
Handle a Player’s Move Eventhttps://realpython.com/tic-tac-toe-python/#handle-a-players-move-event
Update the Game Board to Reflect the Game Statehttps://realpython.com/tic-tac-toe-python/#update-the-game-board-to-reflect-the-game-state
Run Your Tic-Tac-Toe Game for the First Timehttps://realpython.com/tic-tac-toe-python/#run-your-tic-tac-toe-game-for-the-first-time
Step 5: Provide Options to Play Again and Exit the Gamehttps://realpython.com/tic-tac-toe-python/#step-5-provide-options-to-play-again-and-exit-the-game
Build the Game’s Main Menuhttps://realpython.com/tic-tac-toe-python/#build-the-games-main-menu
Implement the Play Again Optionhttps://realpython.com/tic-tac-toe-python/#implement-the-play-again-option
Conclusionhttps://realpython.com/tic-tac-toe-python/#conclusion
Frequently Asked Questionshttps://realpython.com/tic-tac-toe-python/#frequently-asked-questions
Next Stepshttps://realpython.com/tic-tac-toe-python/#next-steps
Remove adshttps://realpython.com/account/join/
prerequisiteshttps://realpython.com/tic-tac-toe-python/#prerequisites
Click here to get access to the source codehttps://realpython.com/bonus/tic-tac-toe-python-code/
https://realpython.com/tic-tac-toe-python/#demo-a-tic-tac-toe-game-in-python
Tkinterhttps://realpython.com/python-gui-tkinter/
standard libraryhttps://docs.python.org/3/library/index.html
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#project-overview
included batteryhttps://peps.python.org/pep-0206/#batteries-included-philosophy
tkinter.Tkhttps://realpython.com/python-gui-tkinter/#building-your-first-python-gui-application-with-tkinter
tkinter.Labelhttps://realpython.com/python-gui-tkinter/#displaying-text-and-images-with-label-widgets
tkinter.Buttonhttps://realpython.com/python-gui-tkinter/#displaying-clickable-buttons-with-button-widgets
gridhttps://realpython.com/python-gui-tkinter/#the-grid-geometry-manager
https://realpython.com/tic-tac-toe-python/#prerequisites
Python GUI Programming With Tkinterhttps://realpython.com/python-gui-tkinter/
Object-Oriented Programming (OOP) in Pythonhttps://realpython.com/python3-object-oriented-programming/
Python “for” Loops (Definite Iteration)https://realpython.com/python-for-loop/
When to Use a List Comprehension in Pythonhttps://realpython.com/list-comprehension-python/
Model-View-Controller (MVC) Explained – With Legoshttps://realpython.com/the-model-view-controller-mvc-paradigm-summarized-with-legos/
Dictionaries in Pythonhttps://realpython.com/python-dicts/
How to Iterate Through a Dictionary in Pythonhttps://realpython.com/iterate-through-dictionary-python/
Main Functions in Pythonhttps://realpython.com/python-main-function/
Write Pythonic and Clean Code With namedtuplehttps://realpython.com/python-namedtuple/
https://realpython.com/tic-tac-toe-python/#step-1-set-up-the-tic-tac-toe-game-board-with-tkinter
code editor or IDEhttps://realpython.com/python-ides-code-editors-guide/
Click here to get access to the source codehttps://realpython.com/bonus/tic-tac-toe-python-code/
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#ensure-the-right-tkinter-version
virtual environmenthttps://realpython.com/python-virtual-environments-a-primer/
packagehttps://realpython.com/python-modules-packages/
Tkinterhttps://docs.python.org/3/library/tkinter.html#module-tkinter
interactivehttps://realpython.com/interacting-with-python/
download pagehttps://www.python.org/downloads/
pyenvhttps://realpython.com/intro-to-pyenv/
Dockerhttps://realpython.com/python-versions-docker/
official download pagehttps://www.python.org/downloads/
Python classhttps://realpython.com/python-classes/
https://realpython.com/tic-tac-toe-python/#create-a-class-to-represent-the-game-board
importhttps://realpython.com/python-import/
namespacehttps://realpython.com/python-namespaces-scope/
fonthttps://docs.python.org/3/library/tkinter.font.html#module-tkinter.font
inheritshttps://realpython.com/inheritance-composition-python/
.__init__()https://realpython.com/python-class-constructor/#object-initialization-with-__init__
super()https://realpython.com/python-super/
stringhttps://realpython.com/python-strings/
non-publichttps://peps.python.org/pep-0008/#designing-for-inheritance
dictionaryhttps://realpython.com/python-dicts/
numbershttps://realpython.com/python-numbers/
Framehttps://realpython.com/python-gui-tkinter/#assigning-widgets-to-frames-with-frame-widgets
.pack()https://realpython.com/python-gui-tkinter/#the-pack-geometry-manager
magic numberhttps://en.wikipedia.org/wiki/Magic_number_(programming)
initializerhttps://realpython.com/python-class-constructor/#object-initialization-with-__init__
main()https://realpython.com/python-main-function/
if __name__ == "__main__":https://realpython.com/python-main-function/#use-if-__name__-__main__-to-control-the-execution-of-your-code
https://files.realpython.com/media/tic-tac-toe-board.2d9a0dbd58c7.png
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#step-2-set-up-the-tic-tac-toe-game-logic-in-python
Click here to get access to the source codehttps://realpython.com/bonus/tic-tac-toe-python-code/
https://realpython.com/tic-tac-toe-python/#define-classes-for-the-players-and-their-moves
data classhttps://realpython.com/python-data-classes/
named tuplehttps://realpython.com/python-namedtuple/
collectionshttps://realpython.com/python-collections-module/
NamedTuplehttps://realpython.com/python-namedtuple/#namedtuple-vs-typingnamedtuple
typinghttps://docs.python.org/3/library/typing.html#module-typing
type hinthttps://realpython.com/python-type-checking/
https://realpython.com/tic-tac-toe-python/#create-a-class-to-represent-the-game-logic
cycle()https://docs.python.org/3/library/itertools.html#itertools.cycle
itertoolshttps://realpython.com/python-itertools/
instance attributeshttps://realpython.com/python3-object-oriented-programming/#class-and-instance-attributes
Booleanhttps://realpython.com/python-boolean/
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#set-up-the-abstract-game-board
list comprehensionhttps://realpython.com/list-comprehension-python/
https://realpython.com/tic-tac-toe-python/#figure-out-the-winning-combinations
https://files.realpython.com/media/tic-tac-toe-winning-combos.5a2ac7488e82.png
https://realpython.com/tic-tac-toe-python/#step-3-process-the-players-moves-on-the-games-logic
Click here to get access to the source codehttps://realpython.com/bonus/tic-tac-toe-python-code/
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#validate-players-moves
https://realpython.com/tic-tac-toe-python/#process-players-moves-to-find-a-winner
breakshttps://realpython.com/python-for-loop/#the-break-and-continue-statements
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#check-for-tied-games
all()https://realpython.com/python-all/
https://realpython.com/tic-tac-toe-python/#toggle-players-between-turns
next()https://docs.python.org/3/library/functions.html#next
https://realpython.com/tic-tac-toe-python/#step-4-process-players-moves-on-the-game-board
Click here to get access to the source codehttps://realpython.com/bonus/tic-tac-toe-python-code/
https://realpython.com/tic-tac-toe-python/#handle-a-players-move-event
the next sectionhttps://realpython.com/tic-tac-toe-python/#update-the-game-board-to-reflect-the-game-state
bindshttps://realpython.com/python-gui-tkinter/#using-bind
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#update-the-game-board-to-reflect-the-game-state
https://realpython.com/tic-tac-toe-python/#run-your-tic-tac-toe-game-for-the-first-time
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#step-5-provide-options-to-play-again-and-exit-the-game
Click here to get access to the source codehttps://realpython.com/bonus/tic-tac-toe-python-code/
https://realpython.com/tic-tac-toe-python/#build-the-games-main-menu
https://realpython.com/tic-tac-toe-python/#implement-the-play-again-option
Remove adshttps://realpython.com/account/join/
https://realpython.com/tic-tac-toe-python/#conclusion
https://realpython.com/tic-tac-toe-python/#frequently-asked-questions
https://realpython.com/tic-tac-toe-python/#next-steps
Make Your First Python Game: Rock, Paper, Scissors!https://realpython.com/python-rock-paper-scissors/
PyGame: A Primer on Game Programming in Pythonhttps://realpython.com/pygame-a-primer/
Build an Asteroids Game With Python and Pygamehttps://realpython.com/asteroids-game-python/
Arcade: A Primer on the Python Game Frameworkhttps://realpython.com/arcade-python-game-framework/
Build a Platform Game in Python With Arcadehttps://realpython.com/platformer-python-arcade/
Build a Tic-Tac-Toe Game Engine With an AI Player in Pythonhttps://realpython.com/tic-tac-toe-ai-python/
https://realpython.com/feedback/survey/article/tic-tac-toe-python/liked/?from=article-footer
https://realpython.com/feedback/survey/article/tic-tac-toe-python/disliked/?from=article-footer
https://realpython.com/team/lpozoramos/
» More about Leodanishttps://realpython.com/team/lpozoramos/
https://realpython.com/team/asantos/
Aldrenhttps://realpython.com/team/asantos/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/bzaczynski/
Bartoszhttps://realpython.com/team/bzaczynski/
https://realpython.com/team/damos/
Davidhttps://realpython.com/team/damos/
https://realpython.com/team/gahjelle/
Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/kfinegan/
Katehttps://realpython.com/team/kfinegan/
https://realpython.com/team/mdriscoll/
Mikehttps://realpython.com/team/mdriscoll/
https://realpython.com/team/pacsany/
Philipphttps://realpython.com/team/pacsany/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=tic-tac-toe-python
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=tic-tac-toe-python
https://realpython.com/feedback/survey/article/tic-tac-toe-python/liked/?from=article-comments
https://realpython.com/feedback/survey/article/tic-tac-toe-python/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Ftic-tac-toe-python%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20Build%20a%20Tic-Tac-Toe%20Game%20With%20Python%20and%20Tkinter&url=https%3A%2F%2Frealpython.com%2Ftic-tac-toe-python%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20Build%20a%20Tic-Tac-Toe%20Game%20With%20Python%20and%20Tkinter%20https%3A%2F%2Frealpython.com%2Ftic-tac-toe-python%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Ftic-tac-toe-python%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
intermediatehttps://realpython.com/tutorials/intermediate/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
Python GUI Programming: Your Tkinter Tutorialhttps://realpython.com/python-gui-tkinter/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=tic-tac-toe-python
Object-Oriented Programming (OOP) in Pythonhttps://realpython.com/python3-object-oriented-programming/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=tic-tac-toe-python
Build a URL Shortener With FastAPI and Pythonhttps://realpython.com/build-a-python-url-shortener-with-fastapi/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=tic-tac-toe-python
What Can I Do With Python?https://realpython.com/what-can-i-do-with-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=tic-tac-toe-python
Python and PyQt: Building a GUI Desktop Calculatorhttps://realpython.com/python-pyqt-gui-calculator/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=tic-tac-toe-python
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Ftic-tac-toe-python%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Ftic-tac-toe-python%2F
Sign-Inhttps://realpython.com/account/login/?next=/tic-tac-toe-python/
Start Herehttps://realpython.com/start-here/
Learning Resourceshttps://realpython.com/search
Code Mentorhttps://realpython.com/mentor/
Python Referencehttps://realpython.com/ref/
Python Cheat Sheethttps://realpython.com/cheatsheets/python/
Support Centerhttps://support.realpython.com/
Learning Pathshttps://realpython.com/learning-paths/
Quizzes & Exerciseshttps://realpython.com/quizzes/
Browse Topicshttps://realpython.com/tutorials/all/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.