tkinter

 

  • It is GUI tool kit
  • It installs along with python itself
  • tinker deals with different elements like buttons, checkboxes,comboxes,textboxes,messageboxes...
  • These elements called WIDGETS
  • Tk denotes about the class which we use to create the root window ie, the main window of our application.
  •  

    How to import tkinter into pytho file?

  • import * from tkinter
  • from tkinter import *
  •  

     

    What is GUI

  • Graphical User Interface
  • It enabels the application to build various wideges on window
  •  

    window.mainloop():

  • loop starts after arranging all the widgets
  •  

    Grid Perameters:

  • sticky: is useful when cell is larger than cell
  •  

    How to create a layout?

    we can create GUI layout in the following ways

  • pack: packs the all widgets, by placing one after another
  • grid: has to denote row and column of widget
  • place; has to mention exact location
  •  

    tkinter -- Grid Perameters

     

     

     

    tkinter -- events

     

  • "", "" and "" , are the events which can be executable with mouse buttons
  • : Left Mouse button

    : middle Mouse button

    : right Mouse button

    : Mouse pointer entered widget

     

    tkinter -- Canvas

     

  • To know complete list of Canvas:
  • To know complete list of Canvas:

    print(dir(tkinter.Canvas))

     

    How to create rectangle with Canvas?

     

    tkinter -- messagebox

     

    from tkinter import messagebox
    print(dir(messagebox))

     

    tkinter Message acceptance status

     

  • If you click on YES button, mentioned program will execute, which is mentioned under TRUE
  •  

  • If you click on NO button, mentioned program will execute, which is mentioned under FALSE
  •  

     

     

    tkinter_print_Numbers_upto 11

     

  • after printing the numbers message box will display on screen
  •  

    tkinter_print_Numbers_If you click on YES

     

  • Click on animation to view video
  •  

     

     

    Print numbers based on value entered in textbox

     

    Click on image to view the video, how this program works

     

     

    min number from textbox and max from combobox

     

    Listbox:

    There are 4 types of selection modes to the listbox

  • Browse: select one item and drag it
  • SINGLE: select single item
  • MULTIPLE: select multiple items
  • EXTENDED: select a range of lines by dragging mouse
  •  

    Print numbers based on value selected in listbox

     

    Click on image to view the video, which denotes how this program works:

     

    Print numbers based on value selected in listbox - Class creation

     

     

    listbox - multiple selection with exception handling

     

     

    Even or odd numbers - with Listbox and radio buttons

     

     

    FileDialogue - AskDirectory

     

    FileDialogue - filedialogue_AskOpenFileNames

     

    FileDialogue - ask_openfilename