Application in Tkinter 1 – Technoinc

Application in Tkinter 1 – Technoinc

Today in this blog we are going to use more buttons and canvas for drawing.

In which First we are going to see how the radio button and check buttons are implemented and how they went work in the application.

As in the previous blog, we saw the widgets to insert radio and check buttons. If you are not aware of this then go to Tkinter Widgets blog first.

So here is the code for the buttons.

First, run this code and then try to make your application.

import tkinter as tk

root = tk.Tk()

v = tk.IntVar()

v1 = tk.IntVar()


# initializing the choice, i.e. Python

languages = [







gender = [(“Male”),(“Female”)]

def ShowChoice():







tk.Label(root,text=”””Choose your favourite programming language:”””,justify = tk.LEFT,padx = 20).pack()

var1 = tk.IntVar()

tk.Checkbutton(root,padx = 20, text=”Python”,


var2 = tk.IntVar()

tk.Checkbutton(root,padx = 20, text=”C++”,command=ShowChoice, variable=var2).pack(anchor=tk.W)

var3 = tk.IntVar()

tk.Checkbutton(root,padx = 20, text=”C”, command=ShowChoice,variable=var3).pack(anchor=tk.W)

var4 = tk.IntVar()

tk.Checkbutton(root, padx = 20,text=”Java”,command=ShowChoice, variable=var4).pack(anchor=tk.W)

var5 = tk.IntVar()

tk.Checkbutton(root, padx = 20,text=”Ruby”,command=ShowChoice, variable=var5).pack(anchor=tk.W)

tk.Label(root,text=”””Gender:”””,justify = tk.LEFT,padx = 20).pack()

for val, language in enumerate(gender):

tk.Radiobutton(root,text=language,padx = 20,variable=v1,command=ShowChoice,value=val).pack(anchor=tk.W)


We get this type of output after running the above code.

Here you can select zero, single or multiple programming languages because they are with check buttons but you can select only one gender from Male and Female because they are with radio buttons.

Now we are going to see different shapes in our application.

Here is one single canvas that demonstrates arc and oval.

from tkinter import Tk, Canvas, Frame, BOTH

class Example(Frame):

                        def __init__(self):



                        def initUI(self):


                                    self.pack(fill=BOTH, expand=1)

                                    canvas = Canvas(self)

                                    canvas.create_oval(100, 100, 400, 300)

                                    canvas.create_arc(30, 200, 90, 100, start=90,extent=180)

                                    points = [10, 10, 200, 200,200, 300, 200,10]


                                    canvas.pack(fill=BOTH, expand=1)

def main():

root = Tk()

            ex = Example()



if __name__ == ‘__main__’:


After running this code, you will get this output.

You can make a single shape too as per your need.

            This is not the end of the Tkinter. You can design your own application as per your needs and imagination.

Leave a Reply

Your email address will not be published. Required fields are marked *