All pastes #90618 Raw Edit

freeone3000

public text v1 · immutable
#90618 ·published 2006-07-17 21:23 UTC
rendered paste body
from qt import *

class chooser_window (QDialog, object):
	def __init__(self, names):
		super(chooser_window, self).__init__()
		self.names = names
		self.layout = QGridLayout(self)
		self.setup()
		#TODO Add more stuff.
	def setup(self):
		combo_box = QComboBox(self)
		for name in self.names:
			combo_box.addItem(name)
		combo_box.editable = False
		
		xpos = 0
		ypos = 0
		self.layout.addWidget(combo_box, xpos, ypos)
		ypos += 1

class main_window (QWidget, object):
	def __init__(self):
		super(main_window, self).__init__()
		self.setCaption("Eternal Lands Card Game")
		self.layout = QGridLayout(self)
		self.setup()
		self.show()
	def setup(self):
		startb = QPushButton("Start", self)
		QPushButton.connect(startb, SIGNAL('pressed()'), self, SLOT('_accepted()'))
		
		xpos = 0
		ypos = 0
		self.layout.addWidget(startb, xpos, ypos)
		ypos += 1
		
	def show_chooser(self, names):
		chooser = chooser_window(names)
		chooser.show()