Предмет: Информатика, автор: qwfgxcs

Створіть новий проєкт, у якому створіть вікно із заголовком “Завдання №2” та з розмірами 500х500, будь-якого кольору (за бажанням).
Створіть кнопку із текстом “Розфарбуй”, розміщену на 200 пікселів від лівого та верхнього краю.
Додайте до кнопки подію Button-1, при виконанні якої колір вікна стане блакитним та буде створюватися напис із текстом “Це вікно було створено Прізвище (вкажіть ваше прізвище)”. Колір напису повинен бути синім, а колір тексту білий, шрифт тексту “Arial 14”. Напис буде розміщуватися на 200 пікселів від лівого краю та на 250 пікселів від верхнього краю. Кнопка після натискання стане недоступною.
Створіть другу кнопку із текстом «Кнопка 2» (розмістіть довільно у вікні, інші властивості кнопки налаштуйте за бажанням), при натисканні на яку колір вікна стане світло зеленим, заголовок вікна зміниться на текст «Практична робота», а напис на кнопці зміниться на «Кнопку натиснуто». Натискання цієї кнопки зробить першу кнопку доступною.

Ответы

Автор ответа: lizakravcenko62
0

from tkinter import *

class MainApp:

   def __init__(self, master):

       self.master = master

       master.geometry('500x500')

       master.title('Практична робота')

       self.label = Label(master, text='')

       self.label.place(x=200, y=250)

       self.button1 = Button(master, text='Розфарбуй', command=self.button1_click)

       self.button1.place(x=200, y=200)

       self.button2 = Button(master, text='Кнопка 2', command=self.button2_click)

       self.button2.place(x=300, y=200)

   def button1_click(self):

       self.master.config(bg='blue')

       self.button1.config(state=DISABLED)

       self.label.config(text='Це вікно було створено Прізвище', fg='white', bg='blue', font=('Arial', 14))

       self.label.place(x=200, y=250)

   def button2_click(self):

       self.master.config(bg='light green')

       self.button1.config(state=NORMAL)

       self.button2.config(text='Кнопку натиснуто')

       self.master.title('Практична робота')

root = Tk()

app = MainApp(root)

root.mainloop()

Похожие вопросы
Предмет: Английский язык, автор: veronikagruzin9
Предмет: Английский язык, автор: manshuk178
Предмет: Английский язык, автор: pasha22883863
Read the text.
These days any teenager is usually thinking about taking his school exams and
deciding on what subjects to study. He might be considering what job to choose for
the future life. He's probably wondering what his first salary will be and how soon
it will be before he earns enough to buy a car or rent a flat. Not Nick D’Alosio.
Nick, from London, recently became a millionaire – not through playing the
lottery, but by designing and developing a phone application which he then sold to
Yahoo for €18m! Nick's experience is the perfect example of how a dream can
become a reality. As a child Nick had always been technical and talented. At the
age of nine he was editing videos and making 3-D models on his computer. Then
at 12, he taught himself basic programming to be able to create apps. From his first
app, launched when he was still twelve, he earned €79 on its first day and this
encouraged him to go on to produce another and another. It was a great hobby. But
for Nick, it was still just that – a hobby. He went to school, went to parties and
played sports just like all the other kids. No one knew that in his bedroom he was
designing things that would soon completely change his life!
A few years later, at fifteen, Nick had the idea for an app that could summarise
news stories, which he called Summly. He wanted young people to get brief
information about news stories, which would let them decide whether they wanted
to read the full versions or not, something that no other app could do. The app
immediately became popular and attracted investment from a big company. Then
the Internet giant, Yahoo, became interested and not only bought the app, but hired
its clever, talented young inventor, too.
So what does the future hold for Nick? He plans to return to education to take his
A levels and later he wants to take a degree. Most of all, he wants to start up new
businesses and continue developing his own ideas. Whatever happens, Nick's
future working life will certainly not be the normal 9-5 routine that most of us have
to look forward to!
launch – запускати у виробництво, починати виробляти
hire – наймати на роботу

I. Read the text and choose the answer (A, B or C) which you think fits best
according to the text. (4 points)
1. These days schoolchildren are usually thinking about …
A taking his school exams.
B taking their school exams.
C buying a car or renting a flat.
2. What is true of most young people?
A They are not ready to make decisions about their future.
B They focus on getting their own car.
C They have many different things on their minds.
3. Nick is from …
A Summly.
B London.
C the USA.
4. Nick learned how to create apps …
A while he was working on videos.
B after learning the first steps of computer programming.
C when he first started school.
5. At the age of twelve, he was taught basic programming …
A by himself.
B by other kids.
C by the giant company.
6. At first producing new apps was just a … for Nick.
A great job
B hobby
C home assignment
7. Nick developed his famous app because …
A he was asked by an important company.
B he needed to make some money.
C he saw a need for it.
8. A few years later, at fifteen, Nick had the idea for an app that could
summarise …
A news stories.
B new stories.
C investments from a big company.
II. Decide if these statements are true or false. (4points)
1. Recently Nick became a millionaire due to the lottery.
2. At the age of nine the boy was editing videos on his computer.
3. A teenager created a phone application that he then sold to Yahoo for €18m.

4. From his first app, produced when he was still twelve, he earned €79 on its first
day.
5. Nick didn’t go to school or parties like other children because he was designing
new things in his bedroom at that time.
6. The new app, that gave brief information about different pieces of news, was
not successful at once.
7. Summly attracted investment from a big company.
8. The Internet giant, Yahoo, wasn’t interested in such a talented young inventor
and only bought the app.
III. Answer the questions. (4 points)
1. Nick D’Alosio was really a self-made millionaire, wasn’t he?
2. Did he work for Yahoo or Summly?
3. How does Nick imagine his future life?
4. Are you currently considering what job to choose for your future life? Explain
your idea.