2

How to create comboboxes in pygame(python 2.7)

I don't want to use tk or wx or any other gui just pygame.

import pygame


class ComboBox(pygame):
    def __init__(self, items, editable, dropdownWidth, width, value):
        self.items = items
        self.editable = editable  # True, the user can type a new value False, the user can only choose from the options
        self.dropdownwidth = dropdownWidth
        self.width = width
        self.value = value # i dont think there is need to

    def onSelChange(self, selection):
        pass

    def onEditChange(self, text):
        pass

    def onFocus(self, focused):
        pass

    def onEnter(self):
        pass

    def refresh(self):
        pass
Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142
Chad
  • 21
  • 3
  • Oh, that's a good question. There's quite a bit of subtle complexity in a combo-box. – Kingsley Jan 29 '19 at 01:15
  • No combo box, but an option box [tips on Adding/creating a drop down selection box in pygame](https://stackoverflow.com/questions/19877900/tips-on-adding-creating-a-drop-down-selection-box-in-pygame/65397627#65397627) or [trying creating dropdown menu pygame, but got stuck](https://stackoverflow.com/questions/59236523/trying-creating-dropdown-menu-pygame-but-got-stuck/65369938#65369938) – Rabbid76 Jan 10 '21 at 13:27
  • Text input: [How to create a text input box with pygame?](https://stackoverflow.com/questions/46390231/how-to-create-a-text-input-box-with-pygame/64613666#64613666) or [How to make a string's content appears on screen as we type on keyboard?](https://stackoverflow.com/questions/60455692/how-to-make-a-strings-content-appears-on-screen-as-we-type-on-keyboard/60456556#60456556) – Rabbid76 Jan 10 '21 at 13:28

0 Answers0