Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Run and Debug Case Study 2 Provide Screenshots of results and updated codes. ################################################### File: breezypythongui.py Version: 1 . 2 Copyright

Problem: Run and Debug Case Study 2
Provide Screenshots of results and updated codes.
###################################################
"""
File: breezypythongui.py
Version: 1.2
Copyright 2012,2013,2019 by Ken Lambert
Resources for easy Python GUIs.
LICENSE: This is open-source software released under the terms of the
GPL (http://www.gnu.org/licenses/gpl.html). Its capabilities mirror those
of BreezyGUI and BreezySwing, open-source frameworks for writing GUIs in Java,
written by Ken Lambert and Martin Osborne.
PLATFORMS: The package is a wrapper around Tkinter (Python 3.X) and should
run on any platform where Tkinter is available.
INSTALLATION: Put this file where Python can see it.
RELEASE NOTES:
Version 1.2 also now includes the class EasyCombobox for
managing combo boxes (updated 08-15-2019).
Version 1.2 also now supports the handling of selections in
multiple list boxes (updated 08-15-2019).
Version 1.2 also now includes the class EasyPanel, for organizing
subpanes in windows and dialogs (updated 12-19-2012).
Version 1.2 now also runs on either Python 3.x.x or
Python 2.x.x (updated 2-4-2013).
"""
import sys
versionNumber = sys.version_info.major
if versionNumber ==3:
import tkinter
import tkinter.simpledialog
Tkinter = tkinter
tkSimpleDialog = tkinter.simpledialog
from tkinter import ttk
else:
import Tkinter
import tkSimpleDialog
from Tkinter import ttk
N = Tkinter.N
S = Tkinter.S
E = Tkinter.E
W = Tkinter.W
CENTER = Tkinter.CENTER
END = Tkinter.END
NORMAL = Tkinter.NORMAL
DISABLED = Tkinter.DISABLED
NONE = Tkinter.NONE
WORD = Tkinter.WORD
VERTICAL = Tkinter.VERTICAL
HORIZONTAL = Tkinter.HORIZONTAL
RAISED = Tkinter.RAISED
SINGLE = Tkinter.SINGLE
ACTIVE = Tkinter.ACTIVE
class EasyFrame(Tkinter.Frame):
"""Represents an application window."""
def __init__(self, title ="", width = None, height = None,
background = "white", resizable = True):
"""Will shrink wrap the window around the widgets if width
and height are not provided."""
Tkinter.Frame.__init__(self, borderwidth =4, relief = "sunken")
if width and height:
self.setSize(width, height)
self.master.title(title)
self.grid()
# Expand the frame within the window
self.master.rowconfigure(0, weight =1)
self.master.columnconfigure(0, weight =1)
self.grid(sticky = N+S+E+W)
# Set the background color and resizability
self.setBackground(background)
self.setResizable(resizable)
def setBackground(self, color):
"""Resets the window's background color to color."""
self["background"]= color
def setResizable(self, state):
"""Resets the window's resizable property to True
or False."""
self.master.resizable(state, state)
def setSize(self, width, height):
"""Resets the window's width and height in pixels."""
self.master.geometry(str(width)+"x"+ str(height))
def setTitle(self, title):
"""Resets the window's title to title."""
self.master.title(title)
# Methods to add widgets to the window. The row and column in
# the grid are required arguments.
def addLabel(self, text, row, column,
columnspan =1, rowspan =1,
sticky = N+W, font = None,
background = "white", foreground = "black"):
"""Creates and inserts a label at the row and column,
and returns the label."""
label = Tkinter.Label(self, text = text, font = font,
background = background,
foreground = foreground)
self.rowconfigure(row, weight =1)
self.columnconfigure(column, weight =1)
label.grid(row = row, column = column,
columnspan = columnspan, rowspan = rowspan,
padx =5, pady =5, sticky = sticky)
return label
def addButton(self, text, row, column,
columnspan =1, rowspan =1,
command = lambda: None,
state = NORMAL):
"""Creates and inserts a button at the row and column,
and returns the button."""
button = Tkinter.Button(self, text = text,
command = command, state = state)
self.rowconfigure(row, weight =1)
self.columnconfigure(column, weight =1)
button.grid(row = row, column = column,
columnspan = columnspan, rowspan = rowspan,
padx =5, pady =5)
return button
def addFloatField(self, value, row, column,
columnspan =1, rowspan =1,
width =20, precision = None,
sticky = N+E, state = NORMAL):
"""Creates and ins

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Implementing Ai And Machine Learning For Business Optimization

Authors: Robert K Wiley

1st Edition

B0CPQJW72N, 979-8870675855

More Books

Students also viewed these Databases questions

Question

outline some of the current issues facing HR managers

Answered: 1 week ago