-
Notifications
You must be signed in to change notification settings - Fork 0
/
textbox.py
40 lines (30 loc) · 1.02 KB
/
textbox.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'''
Created on 20.3.2014
@author: Paleksi
'''
from PyQt4 import QtGui
class TextBox(QtGui.QDockWidget):
'''
The parent of this class is the MainWindow.
The little text frame at the bottom of the screen that updates
the events of each turn, just to make it easier to follow the game
when playing especially with AI.
'''
def __init__(self, parent=None):
super(TextBox, self).__init__(parent)
self.layout = self.setUp()
self.textbox = QtGui.QTextBrowser()
self.layout.addWidget(self.textbox, 0, 0)
self.textbox.setMinimumWidth(400)
self.textbox.setFixedHeight(120)
def setUp(self):
self.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
layout = QtGui.QGridLayout()
widget = QtGui.QWidget()
widget.setLayout(layout)
self.setWidget(widget)
return layout
def update_text(self, text):
self.textbox.append(text)
def clear_text(self):
self.textbox.clear()