Hi, everyone. I wanted to make my wx.Frame subclass modal, so I changed its
inheritance so that my new class would inherit from wx.Dialog instead.
However, the buttons are not being displayed (I'll only post the __init__
method, because I don't think the others are necessary at this topic):
class ChooseNumberForPatientsWithSameNameDialog( wx.Dialog ):
def __init__( self, parent, name ):
global cursor, numberChosen
wx.Dialog.__init__( self, parent = parent, id = -1, title =
'Escolher paciente de acordo com os dados cadastrados',
size = ( 500, 410 ), style = wx.DEFAULT_FRAME_STYLE ^ (
wx.RESIZE_BORDER | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX ) )
self.name = name
#Centers this ChooseNumberForPatientsWithSameNameFrame:
self.Center()
#Creates panel as a child of this
ChooseNumberForPatientsWithSameNameFrame:
self.panel = wx.Panel( parent = self )
#Output string:
output = u'Mais de um paciente foi encontrado com o nome
inserido.\nPor favor digite o número do(a) paciente desejado, de acordo com
os dados cadastrados:\n\n'
#Labels:
self.instructionsLabel = wx.StaticText( self.panel, -1, output, pos
= ( 10, 10 ) )
self.numberLabel = wx.StaticText( self.panel, -1, u'Número
escolhido:', pos = ( 110, 310 ) )
#Field:
self.numberField = wx.TextCtrl( self.panel, -1, '', pos = ( 218, 307
) )
#Buttons:
self.confirmButton = wx.Button( self.panel, label = 'Finalizar', pos
= ( 90, 148 ), size = ( 100, 25 ) )
self.cancelButton = wx.Button( self.panel, label = 'Cancelar', pos =
( 194, 148 ), size = ( 100, 25 ) )
#SQLite query:
results = cursor.execute( 'select * from Paciente where Nome = "' +
name + '"' )
results = results.fetchall()
length = len( results )
counter = 1
#Updates the output:
output = u''
for result in results:
output += 'Nome: ' + unicode( result[ 1 ], 'utf-8' ) +
u'\nNúmero: ' + str( result[ 0 ] ) + '\nIdade: ' + str( result[ 2 ] ) \
+ u'\nEndereço: ' + unicode( result[ 3 ], 'utf-8' ) +
'\nTelefone 1: ' + result[ 4 ] + '\nTelefone 2: ' + result[ 5 ] + \
'\nE-mail: ' + result[ 6 ]
if counter != length:
output += '\n\n'
counter += 1
#Main subwindow:
self.mainTextSubWindow = wx.TextCtrl( self.panel, -1, output, pos =
( 8, 75 ), size = ( 479, 200 ), style = wx.TE_MULTILINE )
#Events binding:
self.Bind( wx.EVT_BUTTON,
self.ValidateFieldAndUpdateNumberChosenIfPossible, self.confirmButton )
self.Bind( wx.EVT_BUTTON, self.CancelNumberChoosing,
self.cancelButton )
···
--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Buttons-on-wx-Dialog-subclass-tp5721263.html
Sent from the wxPython-users mailing list archive at Nabble.com.