Python Tutorial ( PDFDrive )
xview_scroll ( number, what )yview()yview_moveto ( fraction )Scrolls the listbox horizontally. For the what argument, use either UNITS to scrollby characters, or PAGES to scroll by pages, that is, by the width of the listbox.The number argument tells how many to scroll.To make the listbox vertically scrollable, set the command option of theassociated vertical scrollbar to this method.Scroll the listbox so that the top fraction of the width of its longest line is outsidethe left side of the listbox. Fraction is in the range [0,1].yview_scroll ( number, what )Example: Try the following example yourself:from Tkinter import *import tkMessageBoximport Tkintertop = Tk()Lb1 = Listbox(top)Lb1.insert(1, "Python")Lb1.insert(2, "Perl")Lb1.insert(3, "C")Lb1.insert(4, "PHP")Lb1.insert(5, "JSP")Lb1.insert(6, "Ruby")Lb1.pack()top.mainloop()Scrolls the listbox vertically. For the what argument, use either UNITS to scroll bylines, or PAGES to scroll by pages, that is, by the height of the listbox. Thenumber argument tells how many to scroll.When the above code is executed, it produces the following result:Menubutton A menubutton is the part of a drop-down menu that stays on the screen all the time. Every menubutton isassociated with a Menu widget that can display the choices for that menubutton when the user clicks on it.TUTORIALS POINT Simply Easy Learning
Syntax: Here is the simple syntax to create this widget:w = Menubutton ( 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 keyvaluepairs separated by commas.OptionactivebackgroundactiveforegroundAnchorBgBitmapBdCursordirectiondisabledforegroundfgheighthighlightcolorimagejustifymenuDescriptionThe background color when the mouse is over the menubutton.The foreground color when the mouse is over the menubutton.This options controls where the text is positioned if the widget has more space than the textneeds. The default is anchor=CENTER, which centers the text.The normal background color displayed behind the label and indicator.To display a bitmap on the menubutton, set this option to a bitmap name.The size of the border around the indicator. Default is 2 pixels.The cursor that appears when the mouse is over this menubutton.Set direction=LEFT to display the menu to the left of the button; use direction=RIGHT todisplay the menu to the right of the button; or use direction='above' to place the menuabove the button.The foreground color shown on this menubutton when it is disabled.The foreground color when the mouse is not over the menubutton.The height of the menubutton in lines of text (not pixels!). The default is to fit themenubutton's size to its contents.Color shown in the focus highlight when the widget has the focus.To display an image on this menubutton,This option controls where the text is located when the text doesn't fill the menubutton: usejustify=LEFT to left-justify the text (this is the default); use justify=CENTER to center it, orjustify=RIGHT to right-justify.To associate the menubutton with a set of choices, set this option to the Menu objectcontaining those choices. That menu object must have been created by passing theassociated menubutton to the constructor as its first argument.padx How much space to leave to the left and right of the text of the menubutton. Default is 1.pady How much space to leave above and below the text of the menubutton. Default is 1.reliefSelects three-dimensional border shading effects. The default is RAISED.TUTORIALS POINT Simply Easy Learning
- Page 333 and 334: </form>The result of this code is t
- Page 335 and 336: text_content = form.getvalue('textc
- Page 337 and 338: Here is an example of how to retrie
- Page 339 and 340: CHAPTER21Python Database AccessThe
- Page 341 and 342: EXAMPLE: Following is the example o
- Page 343 and 344: ('Mac', 'Mohan', 20, 'M', 2000)try:
- Page 345 and 346: DELETE Operation: DELETE operation
- Page 347 and 348: ProgrammingErrorSubclass of Databas
- Page 349 and 350: The socket Module: To create a so
- Page 351 and 352: Protocol Common function Port No Py
- Page 353 and 354: Subject: SMTP e-mail testThis is a
- Page 355 and 356: try:smtpObj = smtplib.SMTP('localho
- Page 357 and 358: count = 0while count < 5:time.sleep
- Page 359 and 360: Synchronizing Threads: The threadi
- Page 361 and 362: thread = myThread(threadID, tName,
- Page 363 and 364: <stars>10</stars><description>Talk
- Page 365 and 366: print "Rating:", self.ratingelif se
- Page 367 and 368: Format: DVDRating: PGDescription: T
- Page 369 and 370: Tkinter Widgets Tkinter provides v
- Page 371 and 372: fgfontheighthighlightcolorimagejust
- Page 373 and 374: WidthXscrollincrementXscrollcommand
- Page 375 and 376: pattern when it is over the checkbu
- Page 377 and 378: The Entry widget is used to accept
- Page 379 and 380: E1 = Entry(top, bd =5)E1.pack(side
- Page 381 and 382: Optionanchorbgbitmapbdcursorfontfgh
- Page 383: selectmodeDetermines how many items
- Page 387 and 388: Menu The goal of this widget is to
- Page 389 and 390: filemenu.add_command(label="Exit",
- Page 391 and 392: Example: Try the following example
- Page 393 and 394: WidthWraplengthWidth of the label i
- Page 395 and 396: label appears in the top left corne
- Page 397 and 398: Parameters: • master: This repres
- Page 399 and 400: Parameters: • master: This repres
- Page 401 and 402: mark_gravity(mark [,gravity])Return
- Page 403 and 404: Methods & Descriptiondeiconify()Dis
- Page 405 and 406: disabledbackgrounddisabledforegroun
- Page 407 and 408: bgbdThe color of the slider and arr
- Page 409 and 410: fontheightlabelAnchorhighlightbackg
- Page 411 and 412: Standard attributes:Let's take a l
- Page 413 and 414: • family: The font family name as
- Page 415 and 416: B2.pack()B3.pack()B4.pack()B5.pack(
- Page 417 and 418: • "heart"• "heart"• "man"•
- Page 419 and 420: The grid() Method This geometry m
- Page 421 and 422: CHAPTERPython Further Extensions27A
- Page 423 and 424: This table needs to be terminated w
- Page 425 and 426: Passing Function Parameters: Beca
- Page 427 and 428: return (a + b)You can return two va
- Page 429 and 430: CHAPTER28Python Tools/UtilitiesThe
- Page 431: The profile Module: The profile m
Syntax:
Here is the simple syntax to create this widget:
w = Menubutton ( 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
activebackground
activeforeground
Anchor
Bg
Bitmap
Bd
Cursor
direction
disabledforeground
fg
height
highlightcolor
image
justify
menu
Description
The background color when the mouse is over the menubutton.
The foreground color when the mouse is over the menubutton.
This options controls where the text is positioned if the widget has more space than the text
needs. The default is anchor=CENTER, which centers the text.
The normal background color displayed behind the label and indicator.
To display a bitmap on the menubutton, set this option to a bitmap name.
The size of the border around the indicator. Default is 2 pixels.
The cursor that appears when the mouse is over this menubutton.
Set direction=LEFT to display the menu to the left of the button; use direction=RIGHT to
display the menu to the right of the button; or use direction='above' to place the menu
above the button.
The foreground color shown on this menubutton when it is disabled.
The foreground color when the mouse is not over the menubutton.
The height of the menubutton in lines of text (not pixels!). The default is to fit the
menubutton's size to its contents.
Color shown in the focus highlight when the widget has the focus.
To display an image on this menubutton,
This option controls where the text is located when the text doesn't fill the menubutton: use
justify=LEFT to left-justify the text (this is the default); use justify=CENTER to center it, or
justify=RIGHT to right-justify.
To associate the menubutton with a set of choices, set this option to the Menu object
containing those choices. That menu object must have been created by passing the
associated menubutton to the constructor as its first argument.
padx How much space to leave to the left and right of the text of the menubutton. Default is 1.
pady How much space to leave above and below the text of the menubutton. Default is 1.
relief
Selects three-dimensional border shading effects. The default is RAISED.
TUTORIALS POINT
Simply Easy Learning