28.10.2021 Views

Python Tutorial ( PDFDrive )

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

var = StringVar()

label = Label( root, textvariable=var, relief=RAISED )

var.set("Hey!? How are you doing?")

label.pack()

root.mainloop()

When the above code is executed, it produces the following result:

Listbox

The Listbox widget is used to display a list of items from which a user can select a number of items

Syntax:

Here is the simple syntax to create this widget:

w = Listbox ( master, option, ... )

Parameters:

• master: This represents the parent window.

• options: Here is the list of most commonly used options for this widget. These options can be used as keyvalue

pairs separated by commas.

Option

Bg

Bd

Cursor

font

fg

Description

The normal background color displayed behind the label and indicator.

The size of the border around the indicator. Default is 2 pixels.

The cursor that appears when the mouse is over the listbox.

The font used for the text in the listbox.

The color used for the text in the listbox.

height Number of lines (not pixels!) shown in the listbox. Default is 10.

highlightcolor

highlightthickness

relief

selectbackground

Color shown in the focus highlight when the widget has the focus.

Thickness of the focus highlight.

Selects three-dimensional border shading effects. The default is SUNKEN.

The background color to use displaying selected text.

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!