How To Create QTextEdit In PyQt5

In this post i want to show you How To Create QTextEdit In PyQt5 . so QTextEdit is an advanced WYSIWYG viewer/editor supporting rich text formatting using HTML-style tags, or Markdown format. It is optimized to handle large documents and to respond quickly to user input. QTextEdit works on paragraphs and characters. A paragraph is a formatted string which is word-wrapped to fit into the width of the widget. By default when reading plain text, one newline signifies a paragraph. we are going to use some codes from the previous articles.

 

 

 

Read More

 

 

 

Also you can read more Python GUI articles in the below links

 

 

 

 

Now in the first we need some imports.

 

 

 

After we create our main Window class that extends from QMainWindow and in that class we add some requirements  of the window also we are going to create a method of CreateMenu() , in that method we create our menus and toolbars. these are the codes that we have described in the previous articles. now we are just focusing on creating QTextEdit.

 

 

 

Now we create our createEditor() method and in that method we write our QTextEdit codes

 

 

 

Also every PyQt5 application must create an application object. The sys.argv parameter is a list of arguments from a command line.

 

 

 

Finally, we enter the mainloop of the application. The event handling starts from this point. 

 

 

 

 

 

 

Run the complete code and this will be the result

How To Create QTextEdit In PyQt5
How To Create QTextEdit In PyQt5

 

 

 

 

 

 

Complete source code for How To Create QTextEdit In PyQt5

 

 

 

 

 

Also you can watch the complete video for this article.

Subscribe and Get Free Video Courses & Articles in your Email

 

Comments are closed.

Codeloop
Share via
Copy link
Powered by Social Snap
×