Advertisement
here2share

# Tk_Py2_vs_Py3.py

Dec 25th, 2021
1,296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. # Tk_Py2_vs_Py3.py
  2.  
  3. try:  # Python 2.7
  4.     import Tkinter as tk
  5.     import tkColorChooser as color
  6.     import tkCommonDialog as cdialog
  7.     import Tkconstants as const
  8.     import Tkdnd as dnd
  9.     import tkFileDialog as fdialog
  10.     import tkFont as font
  11.     import tkMessageBox as msgbox
  12.     import ScrolledText as stext
  13.     import tkSimpleDialog as sdialog
  14.     import Tix as tix
  15.     import ttk
  16.  
  17. except ImportError:  # Python 3.*
  18.     import tkinter as tk
  19.     from tkinter import (
  20.         colorchooser as color,
  21.         commondialog as cdialog,
  22.         constants as const,
  23.         dialog,
  24.         dnd,
  25.         filedialog as fdialog,
  26.         font,
  27.         messagebox as msgbox,
  28.         scrolledtext as stext,
  29.         simpledialog as sdialog,
  30.         tix,
  31.         ttk
  32.     )
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement