Hey, youtube just suggested me that, I didn't realize you were making videos. Great stuff and thanks again for the help! Indeed pyimgui is currently too close to the cpp dearimgui and would gain to be more inline with the python way. I am hoping to push it in this diretion. :)
Awesome video! I genuinely feel like this is something most programmers need to see demoed for them. It's such a vital process that I suppose most people just try to "figure out" on their own and end up making many embarrassing mistakes. Great resource video, and I'm pretty sure I will be referring people to it when they ask about the process of contributing to open-source projects :))
I wonder if perhaps this could benefit from being more explicit in the title that this is about the process of contributing to open-source projects? I clicked on this thinking that it would just be a showcase of Imgui and its features (ty for the recommendation btw)
You're a true MVP. Also, I cracked at the end with that jk. I can only imagine the pain when seeing how much of those there were. As always, great content! A couple if days ago, i sent some of my students your way, i hope they see the Light with your Teachings
The fact that I now feel really motivated to contribute to something open source is evidence of a well structured video. I also feel a sudden urge to convert my work project from a CLI to a GUI application... Not sure if that is such a necessary thing though :|
Also, is the purpose of Cython to compile C/C++ code with the syntax of Python so that people unfamiliar with such languages get an easier introduction? Or is it perhaps something more subtle?
Cython serves a dual purpose of allowing you to write Python C extensions using Pythonish syntax, as well as allowing you to easily interface with native C and C++ code. The reason for wanting to write Python C extensions is to take advantage of the fact that C compilers do optimization, whereas the Python compiler basically does not.
@@mCoding Interesting... How much usage does Cython see? I've sadly never heard about it before, so I'm presuming it's quite niche? Or maybe I have a talent for avoiding interesting things.
@@coarse_snad It finds heavy usage in tons of frameworks for the given two use cases, but is typically implemented privately with a public interface (like shown here) so you don't notice it as a regular user/non contributor.
@@coarse_snad You don't need to do manual reference counting in Cython (Py_INCREF/Py_DECREF), as compared to when writing Python C extensions. There is also less boilerplate.
Just the other day I was wondering why I still haven't seen some code-UA-camr who was applying what they want to show to a open source project. I hope you get many internet points for this.
Great video! As mentioned by others in the comments, it's very useful to be able to follow your thought process when encountering a problem in software and how you solved it. Really enjoying and learning a ton from your amazing videos!
Wow, I hardly understand what’s going on, but it is all super interesting. I especially enjoyed the part at 6:00 of how you showed how you submitted a pull request, and how you documented your new implementation idea. This was incredible insightful and your documentation of your process and what you hope to do was fantastic. Also loved how you mentioned how you tested your code. The process of implementing your code was so through. Hope go get where you are! Thank you for this! I’ve got a lot to learn 😭😭
Awesome video! A Cython introduction would be very cool.
2 роки тому+1
Amazing work, man. They should have made it like this from the outset, and it's great to see you helped them check that box. This video is also a great promo for Pyimgui; although I never consider making guis in Python, now you made me want to try. Keep up the great work.
This is the second time I've seen great developers that I trust recommend Dear I'm Gui (first one was from The Cherno's channel!) But I have to say, I'm still not sold on Immediate GUIs. Having to do every little thing seems to go against the idea of having a library to abstract away the logic. I will nonetheless still give it a try because the end result looks very good.
I find that immediate mode GUI's are most useful when you are already doing quite a bit of things yourself or are doing something with many updates (e.g. games / rendering) so that you can integrate it closely with the actual data
Hey James!! Great video, great resource and I've finally got a little bit of understanding of what Cython is. Just letting you know that I would really appreciate a Cython overview if one day you have the time and patience. Cheers!!!
damn it's so easy to use this library. plus, contributing to open source is always great, although I feel you did a lot for one PR (but it kinda checks out i would say)
Great video, thanks! I've used cython to speed up the slowest part of a open source project I'm contributing to. I struggled a lot getting started and still do from time to time. I'd love to see your take on it! All the best! :)
Some of your stuff is too advanced for me, but my goodness your channel is gold This is exactly the kind of material I was looking for to become a better programmer (citizen 😉)
As someone who mostly does web-dev that others build the interfaces for, let me just hide in the corner and reeeee-but still admire your use of pythonic ideals.
Major LOL on updating the docs later! Reminds me of my contract work at Google. My team manager wouldn't approve any code pushes until we'd verified that we'd updated the docs.
James, can you please elaborate on what you feel is the best practice for implementing multi-threaded functionality with the imGUI event loop in Python? For example, say I have a UI for managing multiple servers and I am using the select module to check for socket read/writes. I press a button and send a command to one of the servers etc. Should the imGUI event loop be run in its own separate Thread from the socket loop? (PyQT incessantly crashed when I tried this). If so, what would the best method of 'communication' be between these two loops? IPC? Or adding commands to a queue then processing this in a third event loop separate from both imGUI and the socket loop? On that note, should any performant task be handled in the imGUI loop or will that slow down the rendering? I am assuming most people just call a function and that command gets passed to another thread where it can run asynchronously from the rendering? Thanks in advance!
Hi Drygord, great question! Typically the imgui event loop runs on the main thread, as is typical for most guis. Waiting on sockets using select (or more commonly the higher-level interface in the selectors module) should be done off the main thread. When the socket thread has some data for the main thread, set an Event and if it is set, have the main thread grab a Lock and take ownership of the data. I'm available for consulting :) mcoding.io.
I made a PR once for a change i needed without asking. It would fail many tests and the syntax was newer JS code that they didn't support. I got it at the end and it was actually merged after 3 tries though. Don't be a knucklehead like me :D
Thanks, I never seen such cool C++ Ui library and what is even more cooler is that you made a video on it with python Edit: I have 140+ errors. I imported the library and everything but it says that for example it can't find imgui.io or something method
Nice, this PyImgui thing seems like a useful alternative to my beloved PySimpleGUI (which is a nice pythonic wrapper around tkinter, PyQt, WxPython or Remy).
This is a great video. I really appreciate it, thanks! I want to contribute to open source, but I have no idea how (or even where to start). If you can invest your time into how-to videos of contributing to open-source (the way it should be), that I believe, would be very beneficial to our community. Even if you don't have the time for other videos, thank you for this one!
Why didn’t you inherit from `tuple` or a non-typing `collections.namedtuple`? That way you don’t have to manually write (part) of the tuple functionality, and miss other parts. Is that harder in Cython?
Tuple's elements are not named and i dont think i can expose them easily with names. Even if i could like namedtuple, namedtuple stores pyobject*s, not C bools so it wont be as efficient, and i dont want other tuple functionality like all the comparison operations. Theoretically it would have been fine to use tuple or namedtuple, they just didnt quite fit my needs.
Yes, the idea was that even though I don't want this object to have tuple semantics, previously it did and i don't want too break much old code, which very commonly does things like opened, selected = imgui.begin(...)
lol at the end! i typically used tkinter for stuff like this in the past, but imgui seems way cooler, especially now that you can use it more pythonically.
Yes! Please do a Cython tutorial. As a longtime Python programmer, I would like to know in which use cases it might be useful to me to write my code in Cython instead.
Really great video! love the idea of using the 'with' for making sure end() gets called I know it's not the point of the video, but here's a tiiiiny nitpick (I couldn't help myself I'm sorry, feel free to ignore xD) I think you got Imperative and Declarative the wrong way around at 2:50? Dear Imgui runs from start to end, "one thing after another", IE, Imperative. While the initializing everything at startup, "Declaring" the behaviour then letting it do its thing on its own, would be a declarative style.
I've discovered DearPyGUI recently, and have to admit, GUIs were never so easy before (with Tkinter, PyQt or else)... big thumbs up for Jonathan Hoffstadt and Preston Cothren for making imGui framework available in Python!
Random question about PyImgui, but can a Pyimgui be compiled to an executable? Was a bit fuzzy on the line between "This is an interpreter program, using C++ extensions like Numpy" and "This is a program deeply integrated with C++, and is just a pretty transpiler for GUI writing". Assuming it was more like the Numpy scenario, but figured I'd ask because making portable little GUI applications with this sounded really neat. (Admittedly even if it didn't compile down, there is always the PyInstaller route. I'm just asking for hobbyist reasons rather than anything serious.)
Oh second note! Really appreciate this video! Really good dive into a neat topic, but also the casual-but-educational dive into contributing to open source projects never hurts. :)
Good question and thank you! Yes pyimgui is more like numpy. There is the core imgui library written in cpp, then the pyimgui module is a compiled python c extension that calls out to the imgui cpp functions at runtime. It is only portable because the pyimgui maintainer builds binary wheels of the package that include the pre-built c extension and compiled imgui library so you dont need cython or a c compiler to pip install it.
Good question! Because Cython code must be compiled like C or C++ code, I can't just make a change in the code and re run the tests immediately. I have to recompile the library and install it again after every change (that's what pip install -e . -v does in this case). That actually involves recompiling the 11k lines of Pyimgui code as well as the even larger imgui C++ code, which is why it took so long.
I am intrigued to give this a try. It's far better than tkinter in terms of developer experience (even though it's a bit hacky). Pyqt5 still holds the first place in my opinion.
Do the python bindings also work for imPlot or only the base imGui? I'm looking to write a simple one-window gui (no floating/docking etc) just a couple textboxes/labels, some pushbuttons... perhaps a few red/green led-like indicators. ImGui looks very clean, but does it lend itself can it do such an app?
So those if's just for serializing async events in a sync flow, right? I mean, the library calls frame_commands function for every event happened in window and we just select the event with those if's?
There's no async here, it's all synchronous. The frame commands get called once per frame, not once per event. It's some kind of magic that imgui figures out what to draw from just one pass through the render commands!
Besides the superb content you create. I watch your videos a lot, and every time I get this question popping in my head … Are you peter from spider man? But like the bad ass version of him?
images.app.goo.gl/KwnscCFE7D47zss9A Am I right or it’s just me with some 3 AM ideas?😅 I gotta say lately abstractions and inheritance concepts may have got into me and took you as a parent class which peter in spider man inherits from … but it may be just me Either way, Love your content, I learned so much from you :) Thank you!
Hey mCoding! I'd like to ask if you have any experience with kivy? And if so, how do they compare to each other. Imgui has a main drawback in my view, that it intermingles logic and presentation and I doubt that it would scale very well without any problems when creating more complex applications.
Hello! I don't have any experience with kivy. Imgui is great for rapid development, but I can see it being too simple for a large application. For medium sized it works fine though :)
@@mCoding Thanks for the reply. I had tried installing this on my other machine that has an intel processor and it had trouble creating the wheel (I don't know enough to understand what that is or how it works.) I was thinking I needed some c++ related dependency to install imgui. I just installed it on my laptop now when I saw your comment and it works although my laptop has an arm processor and a different setup. So perhaps I changed something on my other machine that was causing the issue? It works now so thanks for replying!
13:07 would be nice if you did videos on PEP8 and maybe just on how to document code properly, maybe you have? i should look for that, new to the channel. and love the content.
Isn't the idea of explicitly beginning and ending something to have it represent itself more visually in the code? In most python code that uses with there's a variable that's invalid when you drop out of the with (and sadly it's not undeclared, but that's another issue, you can't use a file after close anyhow). I think the with statement can work as it's quite explicit too but the structure may simply be better represented by having it be entirely explicit since you're going to call member functions on imgui literally everywhere. I could easily see myself writing imgui.button outside a with unknowingly. But writing it on the wrong side of an end is harder. I've been using a similar structure for generating html documents through yattag. It effectively asks you to nest everything in with statements. Which would get very deep nesting very quickly but you obviously use your own helper functions which alleviates that slightly. It's mostly fine since that's the nature of html. But there were instances where I wished I could have explicit begin and end statements. Also notice how a missing end isn't a silent problem. The exception (control flow breaking) case is the only case where you have an issue that isn't an immediate runtime issue, the moment you test your gui even once it appears. It's hard to imagine this reaching production for me. It never hurts to extend the interface of course. Since it's entirely optional. But I don't think it will be the primary use. The C++ version of the library didn't do it with constructors/destructors either I presume?
Missing end CAN be a silent problem if it's nested deep in some UI that's only visible under some obscure condition. You could have a menu that worked just fine, and without any changes to it directly it breaks and throws an exception because of changes somewhere else to code it relies on. In a complex application, you might not think to check that menu again, because you've never changed any code in that menu, and this is how such issues make it to prod. The with statement helps the UI block close anyways, even if the programmer never expected an exception to be thrown there. I'd imagine the reason the C++ library didn't use constructors/destructor is because creating a new object takes memory that is slow to then release since it's not on the stack. In python, this is less of an issue, because the function returns a tuple which has the same drawbacks, so creating a class that works with "with" doesn't have the same problems for performance. I do agree with you though that this pattern easily leads to huge indents in complex UIs, because especially for buttons and drop owns, one block suddenly indents 2 levels because you need to check that the menu is actually open before rendering.
@@sodiboo I'm pretty sure your constructor/destructor pair in C++ would just be a thin wrapper around two function calls. I can't imagine a compiler failing to optimize that into just calling both functions in an optimized build. But I guess you'd have to test it to really know.
@@0xCAFEF00D You're right, i'm used to C# with a garbage collector. Looking back i have no idea why i thought that was a concern for C++ and i think i agree with you
I've always wanted to contribute to open source projects, but it's hard to find a project you know you can work on, you're allowed to work on, you know you can commit to the project, you know you can do things correctly, etc....
I’ve always wondered how numpy implements the @ operator for matrix multiplication. It’s not a symbol you can normally use in python. would be awesome if you used this example to dig more into python that wraps C!
Hey, youtube just suggested me that, I didn't realize you were making videos. Great stuff and thanks again for the help! Indeed pyimgui is currently too close to the cpp dearimgui and would gain to be more inline with the python way. I am hoping to push it in this diretion. :)
For anyone who doesn't know, Kinox is the maintainer of pyimgui, so show your thanks!
thank you so much for this awesome module!
omg thanks for all your hard work
What an absolute beast.
Awesome video! I genuinely feel like this is something most programmers need to see demoed for them. It's such a vital process that I suppose most people just try to "figure out" on their own and end up making many embarrassing mistakes.
Great resource video, and I'm pretty sure I will be referring people to it when they ask about the process of contributing to open-source projects :))
I wonder if perhaps this could benefit from being more explicit in the title that this is about the process of contributing to open-source projects? I clicked on this thinking that it would just be a showcase of Imgui and its features (ty for the recommendation btw)
Good point! Done
Great, love to see the process of suggesting and implementing a new and useful feature
7:15 I really would like to see some videos about Cython from you in the future. Great video as always, thanks!
There's also DearPyGui.
" Dear PyGui is NOT a wrapping of Dear ImGui in the normal sense. It is a library built with Dear ImGui."
You're a true MVP. Also, I cracked at the end with that jk. I can only imagine the pain when seeing how much of those there were. As always, great content!
A couple if days ago, i sent some of my students your way, i hope they see the Light with your Teachings
Many thanks! Glad you enjoyed.
I really like how this video includes subtle (and direct) hints on how to behave in the open source community.
The fact that I now feel really motivated to contribute to something open source is evidence of a well structured video.
I also feel a sudden urge to convert my work project from a CLI to a GUI application... Not sure if that is such a necessary thing though :|
Also, is the purpose of Cython to compile C/C++ code with the syntax of Python so that people unfamiliar with such languages get an easier introduction? Or is it perhaps something more subtle?
Cython serves a dual purpose of allowing you to write Python C extensions using Pythonish syntax, as well as allowing you to easily interface with native C and C++ code. The reason for wanting to write Python C extensions is to take advantage of the fact that C compilers do optimization, whereas the Python compiler basically does not.
@@mCoding Interesting... How much usage does Cython see? I've sadly never heard about it before, so I'm presuming it's quite niche? Or maybe I have a talent for avoiding interesting things.
@@coarse_snad It finds heavy usage in tons of frameworks for the given two use cases, but is typically implemented privately with a public interface (like shown here) so you don't notice it as a regular user/non contributor.
@@coarse_snad You don't need to do manual reference counting in Cython (Py_INCREF/Py_DECREF), as compared to when writing Python C extensions. There is also less boilerplate.
This is the first time I see how library is developed with random people online and I'm impressed!!
Welcome to the club! I hope I've set a decent example for you.
Just the other day I was wondering why I still haven't seen some code-UA-camr who was applying what they want to show to a open source project.
I hope you get many internet points for this.
Great video! As mentioned by others in the comments, it's very useful to be able to follow your thought process when encountering a problem in software and how you solved it. Really enjoying and learning a ton from your amazing videos!
Thanks so much!
Wow, I hardly understand what’s going on, but it is all super interesting.
I especially enjoyed the part at 6:00 of how you showed how you submitted a pull request, and how you documented your new implementation idea. This was incredible insightful and your documentation of your process and what you hope to do was fantastic.
Also loved how you mentioned how you tested your code. The process of implementing your code was so through. Hope go get where you are! Thank you for this! I’ve got a lot to learn 😭😭
Yes please i want a Cython tutorial. There is no other place to find knowledge this densely packed and valuable
A great tutorial not just for Cython, ImGUI but also how to contribute to open source projects! Kudos. Thank you.
I've used imgui pretty often with C++ projects and I never knew I could use it with python too. Now even more easily! Thank you
Awesome video!
A Cython introduction would be very cool.
Amazing work, man. They should have made it like this from the outset, and it's great to see you helped them check that box. This video is also a great promo for Pyimgui; although I never consider making guis in Python, now you made me want to try. Keep up the great work.
This is the second time I've seen great developers that I trust recommend Dear I'm Gui (first one was from The Cherno's channel!)
But I have to say, I'm still not sold on Immediate GUIs. Having to do every little thing seems to go against the idea of having a library to abstract away the logic.
I will nonetheless still give it a try because the end result looks very good.
I find that immediate mode GUI's are most useful when you are already doing quite a bit of things yourself or are doing something with many updates (e.g. games / rendering) so that you can integrate it closely with the actual data
open source contribution videos are reeaaalllllllly appreciated and needed imo
Hey James!! Great video, great resource and I've finally got a little bit of understanding of what Cython is. Just letting you know that I would really appreciate a Cython overview if one day you have the time and patience. Cheers!!!
Very cool walk through of both the module and the contribution!
wow, I just learned about Imgui through this video and it actually made me consider using this for my next project that requires a gui.
I'm trying to learn c++and have a project planned out. Imgui and implot will feature.
Great stuff! This is what separates the top programmers from the rest of us ;)
Thanks to you, I successfully made "with" support for my project
Awesome!
Excellent video! Excited to see this get merged. I’ll definitely try out pyimgui
way more than i expected from just reading the title :) Great job!
damn it's so easy to use this library. plus, contributing to open source is always great, although I feel you did a lot for one PR (but it kinda checks out i would say)
Great video, thanks!
I've used cython to speed up the slowest part of a open source project I'm contributing to. I struggled a lot getting started and still do from time to time. I'd love to see your take on it!
All the best! :)
Thanks James! Great content, as always! It doesn't seem that daunting to contribute to open source projects anymore
Great content as always. Best non trivial python content on UA-cam.
Some of your stuff is too advanced for me, but my goodness your channel is gold
This is exactly the kind of material I was looking for to become a better programmer (citizen 😉)
You will get there in time :) just keep at it!
@@mCoding thx man :)
That's amazing! It shed light on a problem when I had when I tried to use the with context manager with a python program that did not implement it!
Please please make more videos about advanced C++ techniques. The last one you did was an eye opener 🙂.
As someone who mostly does web-dev that others build the interfaces for, let me just hide in the corner and reeeee-but still admire your use of pythonic ideals.
Love to see this kind of instructive and compelling stuff. Thx!
Great stuff, and a much needed addition to the library! Also very well explained.
4:33 Everytime I talk with a C programmer about RAII.
C++ fan commenting now as requested! Python is also awesome though :D
This is so sweet I love imgui in C++ but now I’ll have to try it in python
Major LOL on updating the docs later! Reminds me of my contract work at Google. My team manager wouldn't approve any code pushes until we'd verified that we'd updated the docs.
you deserve more recognition
Always a great time James!
Afaik there's no proper tutorials for cython on youtube. An in-depth course be a really good resource.
James, can you please elaborate on what you feel is the best practice for implementing multi-threaded functionality with the imGUI event loop in Python?
For example, say I have a UI for managing multiple servers and I am using the select module to check for socket read/writes. I press a button and send a command to one of the servers etc.
Should the imGUI event loop be run in its own separate Thread from the socket loop? (PyQT incessantly crashed when I tried this). If so, what would the best method of 'communication' be between these two loops? IPC? Or adding commands to a queue then processing this in a third event loop separate from both imGUI and the socket loop?
On that note, should any performant task be handled in the imGUI loop or will that slow down the rendering? I am assuming most people just call a function and that command gets passed to another thread where it can run asynchronously from the rendering?
Thanks in advance!
Hi Drygord, great question! Typically the imgui event loop runs on the main thread, as is typical for most guis. Waiting on sockets using select (or more commonly the higher-level interface in the selectors module) should be done off the main thread. When the socket thread has some data for the main thread, set an Event and if it is set, have the main thread grab a Lock and take ownership of the data. I'm available for consulting :) mcoding.io.
@@mCoding Hey thanks for the reply! I will keep your consulting services in mind, as you seem like a great tutor. Cheers!
I made a PR once for a change i needed without asking. It would fail many tests and the syntax was newer JS code that they didn't support. I got it at the end and it was actually merged after 3 tries though. Don't be a knucklehead like me :D
Thanks, I never seen such cool C++ Ui library and what is even more cooler is that you made a video on it with python
Edit: I have 140+ errors. I imported the library and everything but it says that for example it can't find imgui.io or something method
You earned my sub. Thank you for your clear presentation!!
This made me very interested about Cython
Great video!!! We need more emphasis on code literacy and comprehension skills. To write code you have to be able to read code!
Nice, this PyImgui thing seems like a useful alternative to my beloved PySimpleGUI (which is a nice pythonic wrapper around tkinter, PyQt, WxPython or Remy).
My exact thoughts when I saw the begin and end statements! That is begging for a context manager.
A showcase of Cython would be really nice!
1:16 Consolas?
This is a great video. I really appreciate it, thanks! I want to contribute to open source, but I have no idea how (or even where to start). If you can invest your time into how-to videos of contributing to open-source (the way it should be), that I believe, would be very beneficial to our community. Even if you don't have the time for other videos, thank you for this one!
10:52 > _"__repr__()"_
what does that do?
0:39 love the Python emoji mashup 😅
I see you are low-key adding more humor in your video haha
Great video. You covered quite many topics. :D
Why didn’t you inherit from `tuple` or a non-typing `collections.namedtuple`? That way you don’t have to manually write (part) of the tuple functionality, and miss other parts. Is that harder in Cython?
Tuple's elements are not named and i dont think i can expose them easily with names. Even if i could like namedtuple, namedtuple stores pyobject*s, not C bools so it wont be as efficient, and i dont want other tuple functionality like all the comparison operations. Theoretically it would have been fine to use tuple or namedtuple, they just didnt quite fit my needs.
@@mCoding You were careful to allow iterating though; I guess that’s used somewhere?
Edit: oops I missed where you mentioned it’s for unpacking
Yes, the idea was that even though I don't want this object to have tuple semantics, previously it did and i don't want too break much old code, which very commonly does things like opened, selected = imgui.begin(...)
What if I wanted to view imgui windows in notepad-type software instead of a window generated as a background?
lol at the end! i typically used tkinter for stuff like this in the past, but imgui seems way cooler, especially now that you can use it more pythonically.
I hope you will make more videos on Cython.
Looks like streamlit. I really like that style of GUI programming
Excellent work and video :)
do you have intelisense auto complete when working with this library. It does not work wiht the latest pip install
you just made my one reason i didnt want to use pyimgui the reason i want to use pyimgui now 👀
Yes! Please do a Cython tutorial. As a longtime Python programmer, I would like to know in which use cases it might be useful to me to write my code in Cython instead.
Oh, man. I really want to see Cython tutorial
Really great video! love the idea of using the 'with' for making sure end() gets called
I know it's not the point of the video, but here's a tiiiiny nitpick (I couldn't help myself I'm sorry, feel free to ignore xD)
I think you got Imperative and Declarative the wrong way around at 2:50?
Dear Imgui runs from start to end, "one thing after another", IE, Imperative.
While the initializing everything at startup, "Declaring" the behaviour then letting it do its thing on its own, would be a declarative style.
finally a pythonic gui... other ones were ehhh, not so pythonic
Cython!
One of my favorites!
Wonderful for video game development.
✅✅✅✅✅✅
what are your thoughts on pyside?
Never used it!
I've discovered DearPyGUI recently, and have to admit, GUIs were never so easy before (with Tkinter, PyQt or else)... big thumbs up for Jonathan Hoffstadt and Preston Cothren for making imGui framework available in Python!
Random question about PyImgui, but can a Pyimgui be compiled to an executable? Was a bit fuzzy on the line between "This is an interpreter program, using C++ extensions like Numpy" and "This is a program deeply integrated with C++, and is just a pretty transpiler for GUI writing".
Assuming it was more like the Numpy scenario, but figured I'd ask because making portable little GUI applications with this sounded really neat. (Admittedly even if it didn't compile down, there is always the PyInstaller route. I'm just asking for hobbyist reasons rather than anything serious.)
Oh second note! Really appreciate this video! Really good dive into a neat topic, but also the casual-but-educational dive into contributing to open source projects never hurts. :)
Good question and thank you! Yes pyimgui is more like numpy. There is the core imgui library written in cpp, then the pyimgui module is a compiled python c extension that calls out to the imgui cpp functions at runtime. It is only portable because the pyimgui maintainer builds binary wheels of the package that include the pre-built c extension and compiled imgui library so you dont need cython or a c compiler to pip install it.
very informative, thanks James! Seems like you had to do a lot of legwork just to run the tests, why is that?
Good question! Because Cython code must be compiled like C or C++ code, I can't just make a change in the code and re run the tests immediately. I have to recompile the library and install it again after every change (that's what pip install -e . -v does in this case). That actually involves recompiling the 11k lines of Pyimgui code as well as the even larger imgui C++ code, which is why it took so long.
@@mCoding But that's strange, isn't there a build file à la Makefile/CMake to only rebuild the relevant parts?
I am intrigued to give this a try. It's far better than tkinter in terms of developer experience (even though it's a bit hacky). Pyqt5 still holds the first place in my opinion.
Hi, can you make on tutorial on injecting a gui like this into a selenium browser instance?
1:16 Jetbrains Mono? Just a shot in the dark ;)
you're correct
Do the python bindings also work for imPlot or only the base imGui?
I'm looking to write a simple one-window gui (no floating/docking etc) just a couple textboxes/labels, some pushbuttons... perhaps a few red/green led-like indicators.
ImGui looks very clean, but does it lend itself can it do such an app?
So those if's just for serializing async events in a sync flow, right? I mean, the library calls frame_commands function for every event happened in window and we just select the event with those if's?
There's no async here, it's all synchronous. The frame commands get called once per frame, not once per event. It's some kind of magic that imgui figures out what to draw from just one pass through the render commands!
1:16 JetBrains Mono😁
Besides the superb content you create. I watch your videos a lot, and every time I get this question popping in my head …
Are you peter from spider man? But like the bad ass version of him?
Haha which spiderman do I look like?
images.app.goo.gl/KwnscCFE7D47zss9A
Am I right or it’s just me with some 3 AM ideas?😅
I gotta say lately abstractions and inheritance concepts may have got into me and took you as a parent class which peter in spider man inherits from … but it may be just me
Either way,
Love your content, I learned so much from you :) Thank you!
Hey mCoding! I'd like to ask if you have any experience with kivy? And if so, how do they compare to each other. Imgui has a main drawback in my view, that it intermingles logic and presentation and I doubt that it would scale very well without any problems when creating more complex applications.
Hello! I don't have any experience with kivy. Imgui is great for rapid development, but I can see it being too simple for a large application. For medium sized it works fine though :)
I just love the end! 😂
Haha thanks I still havent written the docs yet 😅
Can you create a video guide to install imgui and dear imgui? There is no material for this on UA-cam.
It's actually in the video at 0:59 if you don't blink: pip install imgui[full]
@@mCoding Thanks for the reply. I had tried installing this on my other machine that has an intel processor and it had trouble creating the wheel (I don't know enough to understand what that is or how it works.) I was thinking I needed some c++ related dependency to install imgui. I just installed it on my laptop now when I saw your comment and it works although my laptop has an arm processor and a different setup. So perhaps I changed something on my other machine that was causing the issue? It works now so thanks for replying!
@@mCoding Your technical videos on python are amazing btw! Thank you so much!
Hmm hard to say what the diff could be. Thanks for watching!
LOL the documentation got the usual treatm
13:07 would be nice if you did videos on PEP8 and maybe just on how to document code properly, maybe you have? i should look for that, new to the channel. and love the content.
one of C++'s ImGui user here xD
Damn that's high level 😲
8:37 > _"do docs count as LOC?"_
in adsence of stub files? yes, yes they unfortunately do.
13:06 oh lol
Isn't the idea of explicitly beginning and ending something to have it represent itself more visually in the code? In most python code that uses with there's a variable that's invalid when you drop out of the with (and sadly it's not undeclared, but that's another issue, you can't use a file after close anyhow). I think the with statement can work as it's quite explicit too but the structure may simply be better represented by having it be entirely explicit since you're going to call member functions on imgui literally everywhere. I could easily see myself writing imgui.button outside a with unknowingly. But writing it on the wrong side of an end is harder.
I've been using a similar structure for generating html documents through yattag. It effectively asks you to nest everything in with statements. Which would get very deep nesting very quickly but you obviously use your own helper functions which alleviates that slightly. It's mostly fine since that's the nature of html. But there were instances where I wished I could have explicit begin and end statements.
Also notice how a missing end isn't a silent problem. The exception (control flow breaking) case is the only case where you have an issue that isn't an immediate runtime issue, the moment you test your gui even once it appears. It's hard to imagine this reaching production for me.
It never hurts to extend the interface of course. Since it's entirely optional. But I don't think it will be the primary use. The C++ version of the library didn't do it with constructors/destructors either I presume?
Missing end CAN be a silent problem if it's nested deep in some UI that's only visible under some obscure condition. You could have a menu that worked just fine, and without any changes to it directly it breaks and throws an exception because of changes somewhere else to code it relies on. In a complex application, you might not think to check that menu again, because you've never changed any code in that menu, and this is how such issues make it to prod. The with statement helps the UI block close anyways, even if the programmer never expected an exception to be thrown there.
I'd imagine the reason the C++ library didn't use constructors/destructor is because creating a new object takes memory that is slow to then release since it's not on the stack. In python, this is less of an issue, because the function returns a tuple which has the same drawbacks, so creating a class that works with "with" doesn't have the same problems for performance.
I do agree with you though that this pattern easily leads to huge indents in complex UIs, because especially for buttons and drop owns, one block suddenly indents 2 levels because you need to check that the menu is actually open before rendering.
@@sodiboo I'm pretty sure your constructor/destructor pair in C++ would just be a thin wrapper around two function calls. I can't imagine a compiler failing to optimize that into just calling both functions in an optimized build. But I guess you'd have to test it to really know.
@@0xCAFEF00D You're right, i'm used to C# with a garbage collector. Looking back i have no idea why i thought that was a concern for C++ and i think i agree with you
Can you do a Cython (beginer's) tutorial in the future?
I've always wanted to contribute to open source projects, but it's hard to find a project you know you can work on, you're allowed to work on, you know you can commit to the project, you know you can do things correctly, etc....
I’ve always wondered how numpy implements the @ operator for matrix multiplication. It’s not a symbol you can normally use in python. would be awesome if you used this example to dig more into python that wraps C!
It was added as a new operator in Python 3.5.
Can you make a video
Talking about de cython and cpython
8:47 > _"out parameters"_
niiice
Please show dearpygui
“For sneaky reasons this is going to be faster” lol
It's called I'm Gui, hence the name "Dear I'm Gui".
wheres the code to copy and paste?
Check the github!