Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5969913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:17:55+00:00 2026-05-22T20:17:55+00:00

Just a main widget with a tabs widget in it. The problem is –

  • 0

Just a main widget with a tabs widget in it.

The problem is – when I run it, only part of tabs are shown (as shown on attached picture). So, you need to resize, or scroll tabs to get for the last.

enter image description here

How can I set it so that window shows all tabs from the start?

import sys
from PyQt4.QtGui import *

class MainWindow(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        # making tabs
        tabs = QTabWidget()
        tabs.addTab(QWidget(), '111111')
        tabs.addTab(QWidget(), '222222')
        tabs.addTab(QWidget(), '333333')
        tabs.addTab(QWidget(), '444444')

        # inserting in vbox
        vbox = QVBoxLayout(self)
        vbox.addWidget(tabs)

app = QApplication(sys.argv)
myapp = MainWindow()
myapp.show()
sys.exit(app.exec_())

How can I get it resized for all tabs?
And where the problem is – is it parent widget, or tabs, or vbox?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:17:56+00:00Added an answer on May 22, 2026 at 8:17 pm

    You can use QTabWidget.setUsesScrollButtons(bool)

    import sys
    from PyQt4.QtGui import *
    
    class MainWindow(QWidget):
        def __init__(self, parent=None):
            QWidget.__init__(self, parent)
    
            # making tabs
            tabs = QTabWidget()
            tabs.setUsesScrollButtons(False) #here is
    
            tabs.addTab(QWidget(), '111111')
            tabs.addTab(QWidget(), '222222')
            tabs.addTab(QWidget(), '333333')
            tabs.addTab(QWidget(), '444444')
            # inserting in vbox
            vbox = QVBoxLayout(self)
            vbox.addWidget(tabs)
    
    app = QApplication(sys.argv)
    myapp = MainWindow()
    myapp.show()
    sys.exit(app.exec_())
    

    http://doc.qt.nokia.com/4.7/qtabwidget.html#usesScrollButtons-prop

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just need get some vals located in application.ini(main ini) in the Controller plugin I
I just added an ExecutionHandler to my server pipeline just before my main business
When I try and set the datatable width just the table main section is
I just wanted to know what is the main advantage of using the iterators
int main() { int var = 0;; // Typo which compiles just fine }
Just to rule out the obvious, I am updating the UI from the main
I am just wondering... How to block main thread as JOptionPane (its confirmation dialog)
i've just read a few posts on hiding Silverlight code in some way. Main
I just started learning C, and wrote my hello world program: #include <stdio.h> main()
I just started learning C, and wrote my hello world program: #include <stdio.h> main()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.