2022年1月7日 星期五

Python Tkinter – Message

 Python Tkinter – Message

w = Message( master, options)

Parameters:

  • master: This parameter is used to represents the parent window.
  • options:There are many options which are available and they can be used as key-value pairs separated by commas.

Options:
Following are commonly used Option can be used with this widget :-

  • anchor: This option is used to decide the exact position of the text within the space .Its default value is CENTER.
  • bg: This option used to represent the normal background color.
  • bitmap: This option used to display a monochrome image.
  • bd: This option used to represent the size of the border and the default value is 2 pixels.
  • cursor: By using this option, the mouse cursor will change to that pattern when it is over type.
  • font: This option used to represent the font used for the text.
  • fg: This option used to represent the color used to render the text.
  • height: This option used to represent the number of lines of text on the message.
  • image: This option used to display a graphic image on the widget.
  • justify: This option used to control how the text is justified: CENTER, LEFT, or RIGHT.
  • padx: This option used to represent how much space to leave to the left and right of the widget and text. It’s default value is 1 pixel.
  • pady: This option used to represent how much space to leave above and below the widget. It’s default value is 1 pixel.
  • relief: The type of the border of the widget. It’s default value is set to FLAT.
  • text: This option used use newlines (“\n”) to display multiple lines of text.
  • variable: This option used to represents the associated variable that tracks the state of the widget.
  • width: This option used to represents the width of the widget. and also represented in the number of characters that are represented in the form of texts.
  • wraplength: This option will be broken text into the number of pieces.

from tkinter import *
root = Tk()
root.geometry("300x200")
w = Label(root, text ='GeeksForGeeks', font = "50")
w.pack()

msg = Message( root, text = "A computer science portal for geeks")

msg.pack()
root.mainloop()


沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...