SIP4 python bindings for TQt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mywidget.py 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (c) 2002 Detlev Offenbach <detlev@die-offenbachs.de>
  2. from python_tqt.qt import *
  3. class MyWidget(TQMainWindow):
  4. def __init__(self, parent=None, name=None):
  5. TQMainWindow.__init__(self, parent, name)
  6. self.central = TQVBox(self)
  7. self.central.setMargin(5)
  8. self.central.setSpacing(5)
  9. self.setCentralWidget(self.central)
  10. self.setCaption(self.trUtf8("""Internationalization Example"""))
  11. self.file = TQPopupMenu(self)
  12. self.file.insertItem(self.trUtf8("E&xit"), tqApp, SLOT("quit()"),
  13. TQKeySequence(self.trUtf8("Ctrl+Q","File|Quit")))
  14. self.menuBar().insertItem(self.trUtf8("&File"), self.file)
  15. self.statusBar().message(self.trUtf8('''Language: English'''))
  16. self.label = TQLabel(self.trUtf8("The Main Window"), self.central)
  17. self.gbox = TQButtonGroup(1, TQGroupBox.Horizontal,
  18. self.trUtf8("View"), self.central)
  19. rb = TQRadioButton(tqApp.translate('MyWidget','Perspective'), self.gbox)
  20. rb = TQRadioButton(tqApp.translate('MyWidget','Isometric'), self.gbox)
  21. rb = TQRadioButton(tqApp.translate('MyWidget','Oblique'), self.gbox)
  22. self.initChoices(self.central)
  23. choices = [
  24. QT_TRANSLATE_NOOP("MyWidget", "First"),
  25. QT_TRANSLATE_NOOP("MyWidget", "Second"),
  26. QT_TRANSLATE_NOOP("MyWidget", "Third")
  27. ]
  28. def initChoices(self, parent):
  29. self.lb = TQListBox(parent)
  30. for ch in self.choices:
  31. self.lb.insertItem(self.trUtf8(ch))
  32. def closeEvent(self, e):
  33. TQWidget.closeEvent(self, e)
  34. self.emit(PYSIGNAL('closed'), ())