Suppose you need to display a long message, such as the terms of use for your application. A good way to display this would be to use a wxScrolledMessageDialog. It features a read-only multi-line text box, and it's very easy to put into your applications: from wxPython.wx import * application = wxPySimpleApp() # Set up the text text = """Once upon a time, there lived a knight named Sir Esthimus. Sir Esthimus decided to marry the princess one day. So, he went to the king and asked if he could marry his lovely daughter. The king said that he had to defeat the strongest goblin in the kingdom's dungeons. The knight agreed to fight the goblin, and the next day, the king summoned both the beast and the knight to the town square. A sturdy iron fence had been erected overnight to keep the two fighters inside. The king waved his hand -- the signal for the match to begin. The knight pulled out his sword, and goblin pulled out his spear. The goblin then pierced the knight's sword arm, so the knight lost the fight and did not get to marry the princess. Notice the scrollbar to the right. It enables you to write large amounts of text to the dialog and have it organized neatly.""" # Create the dialog dialog = wxScrolledMessageDialog ( self, text, 'Fairy Tale' ) # Show the dialog dialog.ShowModal()
blog comments powered by Disqus |
|
|
|
|
|
|
|