Using Message Widget In Python GUI Application


In this blog, I am going to create a Message widget in the application. It will be used to display small text content in the Python GUI application. 
Software requirement
Python 3.5 and IDLE (Python 3.5)
Programming code
  1. #Message Display application  
  2. from tkinter  
  3. import * root = Tk()  
  4. root.title("Message App")  
  5. # Message content  
  6. Msg_content = "Welcome to My GUI Application by-PR"  
  7. #Create Message Fuction  
  8. msg = Message(root, text = Msg_content)  
  9. msg.config(font = ('', 20, 'bold'))  
  10. msg.pack()  
  11. root.mainloop()  
About the code
  • First, I am importing the Tkinter module.
  • Next, I have assigned a class and variables.
  • Then, given the application title and create message content.
  • Next, define the message function and configure message style in the code.
  • Finally, I have started the Windows event loop by calling the main loop method and executed the code.
The message has appeared on the application screen.