0

I'd like to use the __feature__ module in PySide6 to use snake_case. Based on the blog post by Qt, I'm supposed to be able to use it like this:

from __feature__ import snake_case, true_property

table = QTableWidget()
table.column_count = 2

button = QPushButton("Add")
button.enabled = False

layout = QVBoxLayout()
layout.add_widget(table)
layout.add_widget(button)

However, I can't use __feature__ since my program doesn't know from which package it came from. I tried doing the code above without the import line, but that still doesn't work. What do I do?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Hernan
  • 59
  • 7
  • What does *my program doesn't know from which package it came from* mean? – eyllanesc Apr 27 '21 at 17:32
  • Are you using an IDE which is complaining about the import? – ekhumoro Apr 27 '21 at 19:17
  • @eyllanesc __feature__ is a module from the Qt library, but I don't know which package it belongs to. I'm assuming I have to type something like ```from PySide6.some package I don't know.__feature__ import snake_case, true_property ``` – Hernan Apr 28 '21 at 10:35
  • @ekhumoro Yes. I'm using Pycharm. – Hernan Apr 28 '21 at 10:37
  • 2
    The rules for using `__feature__` is that you import PySide6 first: `from PySide6.some package ` and then `from __feature__ import snake_case, true_property`. That is to say, after importing PySide6 it is just available to use `__feature__`. Obviate the warnings of your IDE – eyllanesc Apr 28 '21 at 13:16

0 Answers0