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.. <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/stylesheet.html">http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/stylesheet.html</a> .Here is the sample code with which I tried this code but didn't work. Correct me please..<br>
<br>from PyQt4 import QtCore, QtGui<br>import sys<br>class Ui_TabWidget(object):<br> def setupUi(self, TabWidget):<br> TabWidget.setObjectName("TabWidget")<br> TabWidget.resize(400, 300)<br> tabBar=QtGui.QTabBar(TabWidget)<br>
tabBar.addTab("Tab1")<br> tabBar.setTabText(0,"hello")<br> tabBar.addTab("Tab2")<br> tabBar.setTabText(1,"hai")<br> tabBar.setStyleSheet("QTabBar{margin-left: 5;margin-right: 5;}")<br>
TabWidget.setTabBar(tabBar)<br> self.retranslateUi(TabWidget)<br> QtCore.QMetaObject.connectSlotsByName(TabWidget)<br> <br> def retranslateUi(self, TabWidget):<br> TabWidget.setWindowTitle(QtGui.QApplication.translate("TabWidget", "TabWidget", None, QtGui.QApplication.UnicodeUTF8))<br>
<br>app = QtGui.QApplication(sys.argv)<br>TabWidget = QtGui.QTabWidget()<br>ui = Ui_TabWidget()<br>ui.setupUi(TabWidget)<br>TabWidget.show()<br>sys.exit(app.exec_())<br><br> <br>