[PyQt] Re:Spacing between tabs in QTabWidget etc...
Jebagnana Das
jebagnanadas at gmail.com
Sun Dec 13 03:18:34 GMT 2009
Thanks Selim Tuvi for your reply. I've created a tab bar and i set that for
the tabwidget. But when i tried to set the stylesheet properties like
right-margin:5 and left-margin:5 it didn't work. However i think this
property must be set for the tab2 alone.. How to get an instance for tab2??
To my dismay this link didn't work as well..
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/stylesheet.html.Here
is the sample code with which I tried this code but didn't work.
Correct me please..
from PyQt4 import QtCore, QtGui
import sys
class Ui_TabWidget(object):
def setupUi(self, TabWidget):
TabWidget.setObjectName("TabWidget")
TabWidget.resize(400, 300)
tabBar=QtGui.QTabBar(TabWidget)
tabBar.addTab("Tab1")
tabBar.setTabText(0,"hello")
tabBar.addTab("Tab2")
tabBar.setTabText(1,"hai")
tabBar.setStyleSheet("QTabBar{margin-left: 5;margin-right: 5;}")
TabWidget.setTabBar(tabBar)
self.retranslateUi(TabWidget)
QtCore.QMetaObject.connectSlotsByName(TabWidget)
def retranslateUi(self, TabWidget):
TabWidget.setWindowTitle(QtGui.QApplication.translate("TabWidget",
"TabWidget", None, QtGui.QApplication.UnicodeUTF8))
app = QtGui.QApplication(sys.argv)
TabWidget = QtGui.QTabWidget()
ui = Ui_TabWidget()
ui.setupUi(TabWidget)
TabWidget.show()
sys.exit(app.exec_())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091213/2784ed25/attachment.html
More information about the PyQt
mailing list