python compiler application in tkinter code example

Example 1: basic tkinter gui

import tkinter as tk
root = tk.Tk()
root.title("my title")
root.geometry('200x150')
root.configure(background='black')

#	enter widgets here

root.mainloop()

Example 2: python compiler application in tkinter

Tkinter widget

Example 3: python compiler application in tkinter

from tkinter import *
import tkinter
top = tkinter. Tk()
f=Frame (top, height=100,width=200)
CheckVar=IntVar()
f.pack()
def display():
   x=CheckVar.get()
   if(x==1):
     str="you have selected Music"
   else:
     str="you have selected Video"
   l=Label (top, text=str)
   l.pack()
C1 = Checkbutton (top, text = "Music", variable = CheckVar,
onvalue = 1, offvalue = 0, height=5,
width = 20, command=display)
C2 = Checkbutton (top, text = "Video", variable = CheckVar,
onvalue = 2, offvalue = 0, height=5,
width = 20, command=display)
C1.pack()
C2.pack()

Example 4: python compiler application in tkinter

from tkinter import *
import tkinter
top = tkinter. Tk()
f=Frame (top, height=100,width=200)
CheckVar=IntVar()
f.pack()
def display():
   x=CheckVar.get()
   if(x==1):
     str="you have selected Music"
   else:
     str="you have selected Video"
   l=Label (top, text=str)
   l.pack()
C1 = Checkbutton (top, text = "Music", variable = CheckVar,
onvalue = 1, offvalue = 0, height=5,
width = 20, command=display)
C2 = Checkbutton (top, text = "Video", variable = CheckVar,
onvalue = 2, offvalue = 0, height=5,
width = 20, command=display)
C1.pack()
C2.pack()