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 8958679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:16:11+00:00 2026-06-15T15:16:11+00:00

In my function I have dictionary with empty values: self.items = { ‘Maya Executable’:

  • 0

In my function I have dictionary with empty values:

self.items = {
'Maya Executable': '',
'Render': '',
'Mayapy Interpreter': '',
'imgcvt': '',
'IMConvert': '',
}

How should I set “Maya Executable” (i.e. the 0th key) as the QComboBox’s default item to be selected when it loads?

I tried:

self.appExeCB=QtGui.QComboBox()
self.appExeCB.setCurrentIndex(0)
self.appExeCB.addItems(self.items.keys())

But this doesn’t set the default value 🙁

  • 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-06-15T15:16:12+00:00Added an answer on June 15, 2026 at 3:16 pm

    Python Dictionaries are not ordered. self.items.keys()[0] may return different results each time. To solve your problem you should add the items first and then pass the index of ‘Maya Executable’ from the self.items.keys() to self.appExeCB.setCurrentIndex:

    self.appExeCB=QtGui.QComboBox()
    self.appExeCB.addItems(self.items.keys())
    self.appExeCB.setCurrentIndex(self.items.keys().index('Maya Executable'))
    

    Note that this will not put the items in the QComboBox in the order you declared in self.items because as said before Python Dictionaries are not ordered.

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

Sidebar

Related Questions

I have a function which repeatedly indexes into a dictionary with the same key.
I have a function written in C# which has one parameter type as Dictionary<string
I have a function that returns an entry on a dictionary, based on the
I have a function, that returns the next higher value of a Dictionary-Keys-List compared
I have a function in view.py which returns two variables i.e. a dictionary named
I have an object Dictionary<int, Dictionary<int, Foo> > on one side, and a function
I have a python function that randomize a dictionary representing a position specific scoring
I have an interesting problem, which is a function that returns a Dictionary<String,HashSet<String>> .
How to convert Ruby Hash to C# Dictionary? Do we have any built-in function...or
So I have this code in python that writes some values to a Dictionary

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.