Coder Social home page Coder Social logo

videossamplecode's People

Contributors

jamesmurphy-mc avatar raoulcapello avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

videossamplecode's Issues

issue with running pyimgui demo.py

Hi James,

  • I'm running MacOS 11.6 Big Sur
  • I created a new virtualenv with python version 3.7.9
  • I ran pip install imgui[full]

After activating my virtualenv and runnIng demo.py (which I downloaded from your git hub repo), I got the following error:
ImportError: ('Unable to load OpenGL library', 'dlopen(OpenGL, 10): image not found', 'OpenGL', None)

Which I was able to fix by following the directions here
basically, by modifying ctypesloader.py file in my virtualenv's lib/python3.6/site-packages/OpenGl/platform directory

and changing this:
fullName = util.find_library( name )

to this:
fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'

Then at least I was able to get demo.py to launch and the main window came up.

Though I did notice that the first window Hello, Imgui! opened right on top of the Active Examples window, and slightly too small... all the other windows also open right on top of the other windows that were already displayed. Not sure if that's an issue but, from the video it didn't look demo.py behaved that way when you ran it. Though I did notice that a imgue.ini file did appear that seems to manage the window sizes and locations...

That minor issue aside, when I try the menu bar example window, it shows fine, but when I click the close menu item on that window's file menu, the program crashes & I get the following error.

(imgui_37) Gregs-5k-iMac-Octo-Core-2:imgui gskluzacek$ python demo.py 
exception caught, but too late!
Traceback (most recent call last):
  File "demo.py", line 296, in <module>
    main()
  File "demo.py", line 289, in main
    render_frame(impl, window, jb)
  File "demo.py", line 249, in render_frame
    imgui.render()
  File "imgui/core.pyx", line 1891, in imgui.core.render
imgui.core.ImGuiError: ImGui assertion error (g.CurrentWindowStack.Size == 1) at imgui-cpp/imgui.cpp:3476

The one other issue I'm seeing is that when I try to open the last four example windows: tab bar, list box, popup context void and table, the program crashes with errors similar to the following:

(imgui_37) Gregs-5k-iMac-Octo-Core-2:imgui gskluzacek$ python demo.py 
Traceback (most recent call last):
  File "demo.py", line 296, in <module>
    main()
  File "demo.py", line 289, in main
    render_frame(impl, window, jb)
  File "demo.py", line 245, in render_frame
    frame_commands()
  File "demo.py", line 180, in frame_commands
    if imgui.begin_tab_bar("MyTabBar"):
AttributeError: module 'imgui' has no attribute 'begin_tab_bar'

The attribute name mentioned in the error messages and the line number specified varies. For example: for the list box example, the attribute named in the error is begin_list_box and the line number is 197 instead of 189 as shown above.

Additionally, the simple Basic GUI drawing loop code given on the pyimgui read the docs site does not bring up the window as shown there. The program just runs and exists without any thing being displayed and no error messages.

I'm rather suspect at this point, since the original error that occurred with openGL.

Do you think its my installation, OS, ??? Do you have any suggestions that you think I should try?

Here is the code from the pyimgui read the docs site:

import imgui

# initilize imgui context (see documentation)
imgui.create_context()
imgui.get_io().display_size = 100, 100
imgui.get_io().fonts.get_tex_data_as_rgba32()

# start new frame context
imgui.new_frame()

# open new window context
imgui.begin("Your first window!", True)

# draw text label inside of current window
imgui.text("Hello world!")

# close current window context
imgui.end()

# pass all drawing comands to the rendering pipeline
# and close frame context
imgui.render()
imgui.end_frame()

Here's a screen shot of the example windows that I am able to open
image


By the way, I really love the content that you put out on your Youtube channel. I think what you contribute to the community is just fantastic. Keep up the good work.

Regards,
Greg Skluzacek

AttributeError: module 'imgui' has no attribute 'begin_table'

I tested the demo.py (renamed to imguitest.py) and it works, but if I try the tab bar the program crashes with the following Messages:

PS C:\Microsoft VS Code\Projekte> & "C:/Microsoft VS Code/Python/python.exe" "c:/Microsoft VS Code/Projekte/imguitest.py"
Traceback (most recent call last):
File "c:/Microsoft VS Code/Projekte/imguitest.py", line 296, in
main()
File "c:/Microsoft VS Code/Projekte/imguitest.py", line 289, in main
render_frame(impl, window, jb)
File "c:/Microsoft VS Code/Projekte/imguitest.py", line 245, in render_frame
frame_commands()
File "c:/Microsoft VS Code/Projekte/imguitest.py", line 180, in frame_commands
if imgui.begin_tab_bar("MyTabBar"):
AttributeError: module 'imgui' has no attribute 'begin_tab_bar'

Can anyone help?

Error in the code for the Exercise

The code you have provided has an error. The variable "shape" has been used even before declaring it. Replacing it from the current position to the line above "# Understand with for-loops" will rectify the error. Here's the corrected code.

# Answer
y = np.array([2, 3, 4]).reshape(1, 3, 1, 1)
# or
# y = np.array([2, 3, 4]).reshape(3, 1, 1)

shape = (1000, 3, 32, 32)

# Understand with for-loops
x = np.ones(shape, dtype=np.uint8) # for example

out = np.empty(shape, dtype=np.uint8)
N, C, W, H = shape
for n in range(N):
    for channel in range(C):
        for w in range(W):
            for h in range(H):
                out[n, channel, w, h] = x[n, channel, w, h] * y[0, channel, 0, 0]

Thank you.

Video 89: code broke with flake8 version 5.0.0

The example of video 89 doesn't work anymore with flake8 versions 5.0.0-5.0.2. I confirmed I can get desired behavior with version 4.0.1. The requirements.txt in video 89 lists flake8>=4.0, but to be correct that should be changed to flake8>=4.0<5

To reproduce the breaking change just install flake8 (which will install version 5+):

$ cd videos/089_custom_linting_with_ast
$ flake8 .
There was a critical error during execution of Flake8:
plugin code for `local[MCOD1]` does not match ^[A-Z]{1,3}[0-9]{0,3}$

Expected was no critical error.


Nowhere does local[MCOD1] occur, so my bet's on a bug in flake8.
Some extra information on my actual setup on which I encountered the bug:

$ flake8 --version
5.0.0 (mccabe: 0.7.0, pycodestyle: 2.9.0, pyflakes: 2.5.0) CPython 3.10.4 on Windows

crash when used in colab

i forked your "77 metaclasses in Python/overloading.py" to use in a project and found that even though it works normally on my local machine but it crashes in a googlecolab when used

Python dictConfig example config is inaccurate

This is not the correct way to configure the root logger. This configures the logger named "root", which is a child of the actual root logger. The effect is that logger = logging.getLogger("my_logger") does not use the configuration from the JSON (since "my_logger" is not a child of "root", but of the actual root logger, which has not been configured).

"loggers": {
"root": {
"level": "DEBUG",
"handlers": [
"stderr",
"file"
]
}
}

The root logger uses a separate root key (source), so the correct JSON would be

  "loggers": {},
  "root": {
    "level": "DEBUG",
    "handlers": [
      "stderr",
      "file"
    ]
  }

(the empty "loggers" key can probably be skipped).

AttributeError: __enter__

I am using the following function as a decorator:

def profile_func(func):
    def decorator_func(*args, **kwargs):
        with cProfile.Profile() as pr:
            val = func(*args, **kwargs)
        stats = pstats.Stats(pr)
        stats.sort_stats(pstats.SortKey.TIME)
        stats.dump_stats(filename=os.path.join(memex_utils.config.session, 'profiling.prof'))
        return val
    return decorator_func

But I get the following error:

with cProfile.Profile() as pr:
AttributeError: __enter__

I am using Python 3.7

Wrong title (63)

63 line in README.md table should have this name: Diagnose slow Python code. (Feat. async/await)
Not Find why your Python code is slow using this essential tool. (Feat. async/await)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.