Question

In python, create a series of 14 white bars separated by black regions. Each bar should...

In python, create a series of 14 white bars separated by black regions. Each bar should be 11 pixels wide and 230 pixels high. The separation between the bars should be 19 pixels.

Homework Answers

Answer #1

Code:

import tkinter as tk
# --- constants --- (UPPER_CASE_NAMES)
WHITEWIDTH = 11
# --- main --- (lower_case_names)
root = tk.Tk()
root.geometry("439x230")
canvas = tk.Canvas(root)
canvas.config(width=439, height=230,background='black')
canvas.pack()
for i in range(14):
x1 = 19*(i+1)+11*i
y1 = 0
x2 = x1 + WHITEWIDTH
y2 = y1 + 230
canvas.create_rectangle((x1, y1, x2, y2), fill='white')
root.mainloop()

Hope this helps.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
) Code 39 is a common bar code system that consists of narrow and wide bars...
) Code 39 is a common bar code system that consists of narrow and wide bars (black) separated by either wide or narrow spaces (white). Each character contains nine elements (five bars and four spaces). The code for a character starts and ends with a bar (either narrow or wide) and a (white) space appears between each bar. The original specification (since revised) used exactly two wide bars and one wide space in each character. For example, if b and...
Use Python to Complete the following on a single text file and submit your code and...
Use Python to Complete the following on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples: Sum all the items in a list. Multiply all the items in a list. Get the largest number from a list. Get the smallest number from a list. Remove duplicates from a list. Check a list is empty or not. Clone or copy...
Findings  In a cohort of 2215 adults with COVID-19 who were admitted to intensive care units at...
Findings  In a cohort of 2215 adults with COVID-19 who were admitted to intensive care units at 65 sites, 784 (35.4%) died within 28 days, with wide variation among hospitals. Factors associated with death included older age, male sex, morbid obesity, coronary artery disease, cancer, acute organ dysfunction, and admission to a hospital with fewer intensive care unit beds. Meaning  This study identified demographic, clinical, and hospital-level factors associated with death in critically ill patients with COVID-19 that may be used to...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...
Gender Bias in the Executive Suite Worldwide The Grant Thornton International Business Report (IBR) has described...
Gender Bias in the Executive Suite Worldwide The Grant Thornton International Business Report (IBR) has described itself as "a quarterly survey of business leaders from across the globe … surveying 11,500 businesses in 40 economies across the globe on an annual basis." 1 According to the 2011 IBR, the Asia Pacific region had a higher percentage (27 percent) of female chief executive officers (CEOs) than Europe and North America. Japan is the only Asia Pacific region exception. The report further...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
During the trial, lawyers for the accused said that the men believed that the accounting decisions...
During the trial, lawyers for the accused said that the men believed that the accounting decisions they made were appropriate at the time, and that the accounting treatment was approved by Nortel’s auditors from Deloitte & Touche. Judge Marrocco accepted these arguments. Marrocco added he was “not satisfied beyond a reasonable doubt” that the trio (i.e., Dunn, Beatty, and Gollogly) had “deliberately misrepresented” financial results. Given the facts of the case, do you believe Judge Marrocco’s decision was justified? Explain....
What role could the governance of ethics have played if it had been in existence in...
What role could the governance of ethics have played if it had been in existence in the organization? Assess the leadership of Enron from an ethical perspective. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among the top Fortune 500 companies, collapsed in 2001 under a mountain of debt...
Discuss ethical issues that can be identified in this case and the mode of managing ethics...
Discuss ethical issues that can be identified in this case and the mode of managing ethics Enron finds itself in this case. How would you describe the ethical culture and levels of trust at Enron? Provide reasons for your assessment. THE FALL OF ENRON: A STAKEHOLDER FAILURE Once upon a time, there was a gleaming headquarters office tower in Houston, with a giant tilted "£"' in front, slowly revolving in the Texas sun. The Enron Corporation, which once ranked among...