• Python: 3.8.11
  • OS: Ubuntu Kylin 20.04
  • Conda: 4.10.1
  • PyCharm: 2021.1.3 (Community Edition)

code

@author: Date: 8/6/21 ""
from tkinter import *


def main() :
    root = Tk()

    v = IntVar()
    v.set(3)  # If 1, Confucianism is selected by default
    # If 2, then Taoism is selected by default
    # If 3, then Buddhism is selected by default

    rb1 = Radiobutton(root, text='Confucian', variable=v, value=1, indicatoron=False)
    rb1.pack()

    rb2 = Radiobutton(root, text='Taoism', variable=v, value=2, indicatoron=False)
    rb2.pack()

    rb3 = Radiobutton(root, text='buddhist', variable=v, value=3, indicatoron=False)
    rb3.pack()

    rb4 = Radiobutton(root, text='the mohist school', variable=v, value=4, indicatoron=True)
    rb4.pack()

    rb5 = Radiobutton(root, text='everybody', variable=v, value=5, indicatoron=True)
    rb5.pack()

    rb6 = Radiobutton(root, text='Yin-yang House', variable=v, value=6, indicatoron=True)
    rb6.pack()


    mainloop()


if __name__ == '__main__':
    main()

Copy the code

The results

The resources

  • Tkinter document

Learning to recommend

  • Python documentation – English
  • Python documentation – Chinese
  • Python code PEP
  • Google version of the Python specification
  • Python source code
  • Python PEP
  • Optimal kirin
  • The nuggets platform
  • Gitee platform


Python is open source, cross-platform, interpretive, and interactive, and worth learning. Python’s design philosophy: elegant, unambiguous, simple. Advocate one way, preferably only one way to do one thing. Guis can be created with PyQt5, PySide2, wxPython, PyGObject, wxWidgets, etc. Code should be written in accordance with specifications to facilitate communication and understanding. Every language has its own unique ideas. Beginners need to change their thinking, practice and accumulate.