Class Notes (835,006)
Canada (508,865)
CSCA20H3 (25)
Lecture

Tkinter.docx

4 Pages
105 Views
Unlock Document

Department
Computer Science
Course
CSCA20H3
Professor
Benj Hellie
Semester
Winter

Description
Tkinter Windowthe parent widgetLabel the child widget What you show in the label is the text which is a type of string the text can be static the text can be changeablethen the way you assign the values to the text may be differentFor all cases to construct a GUI by using Tkinter the first two steps is always th sameo From Tkinter import o WindowTk1 if you want to insert a label with static text contento labelLabelwindow texthello laurao labelpack2 if youw ant to insert a label with a texta nd then want to change the text into another textthen after the above step o labelconfigtextchange to another linethis way if you want to change the content of the label you just need to type this linethis is a way to erase the old text content and add in new onesbut is there another way of just insert a changeable string into the label as the text content so that you just need to change the string without accessing the label itselfThe following method will work3 if you want to inserta label whose text is changeable depending on the string youo put into it then you need to insert the stringVar firstrecall that string is immutable but StringVar is and then attach this String Var into the labelo dataStringVar o datasethello laurao labelLabelwindow textvariabledatao labelpackthis wayeverytime the data is changed the label is changed wrt its contento so if you later typle o datasetI loveyouthe Tkinter window will show this line airtimeohence
More Less

Related notes for CSCA20H3

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit