-


label.place(x = 50, y = 20, width = 100, height = 25)



Download 9,79 Mb.
Pdf ko'rish
bet53/64
Sana16.01.2022
Hajmi9,79 Mb.
#372467
1   ...   49   50   51   52   53   54   55   56   ...   64
Bog'liq
[Nichola Lacey] Python by Example Learning to Pro(1)

label.place(x = 50, y = 20, width = 100, height = 25) 
Specifies the position in which the object will appear in the window. If the position is 
not specified the item will not appear in the window. 
entry_box.delete(0, END) 
Deletes the contents of an entry or 
list box. 
num = entry_box.get() 
Saves the contents of an 
entry box
 and stores it 
in a variable called num. This does not work 
with message boxes. 
answer = output_txt[“text”] 
Obtains the contents of a 
message box
 and 
stores it in a variable called answer. This does 
not work with an entry box. 
output_txt[“text”] = total 
Changes the content of a message box to 
display the value of the variable total. 
window.mainloop() 
This must be at the end of the program to make 
sure it keeps working. 
Every challenge you 
complete helps you 
become a better 
programmer. 


1114 
 
Challenges 124 - 132: Tkinter GUI 
 
 
Challenges 
 
124 
 
Create a window that will 
ask the user to enter their 
name. When they click on 
a button it should display 
the message “Hello” and 
their name and change 
the background colour 
and font colour of the 
message box. 
125 
 
Write a program that 
can be used instead 
of rolling a six-sided 
die in a board game. 
When the user clicks 
a button it should 
display a random 
whole number 
between 1 to 6 
(inclusive). 
126 
 
Create a program that will ask 
the user to enter a number in a 
box. When they click on a 
button it will add that number 
to a total and display it in 
another box. This can be 
repeated as many times as 
they want and keep adding to 
the total. There should be 
another button that resets the 
total back to 0 and empties the 
original text box, ready for 
them to start again. 
127 
 
Create a window that will ask the user to enter a 
name in a text box. When they click on a button it 
will add it to the end of the list that is displayed on 
the screen. Create another button which will clear 
the list. 
128 
 
1 kilometre = 0.6214 miles and 1 
mile = 1.6093 kilometres. Using 
these figures, make a program 
that will allow the user to 
convert between miles and 
kilometres. 
129 
 
Create a window that will ask the 
user to enter a number in a text box. 
When they click on a button it will 
use the code 

Download 9,79 Mb.

Do'stlaringiz bilan baham:
1   ...   49   50   51   52   53   54   55   56   ...   64




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish