Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Get Value Of An Enum #1585

Closed
Closed
Milestone
@saroad2

Description

@saroad2

Environment

  • Pythonnet version: latest
  • Python version: 3.9.4
  • Operating System: Windows
  • .NET Runtime:

Details

  • Describe what you were trying to get done.

I would like to have the ability to extract the value of a .NetEnum via python. One can do that usingMyEnum.value__, however it seems logical that you should do it usingint(MyEnum).

importclrclr.AddReference("System.Windows.Forms")importSystem.Windows.FormsasWinFormsenum_value=WinForms.Keys.Controlprint(f"{enum_value=}")print(f"{enum_value.value__=}")

That prints:

enum_value=<System.Windows.Forms.Keys object at 0x000001C053E07580>enum_value.value__=131072
  • If there was a crash, please include the traceback here.

No crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp