r/Python • u/import-username-as-u • Sep 28 '19
I dislike Tkinter so I made a Drag-and-Drop Gui builder to make it less painful.
45
39
u/5Beans6 Sep 28 '19
OH-LY-FUCK! Thank you so much!!! I have always wanted to make GUI programs but the tedious process thats involved is so incredibly unfufilling for me that it kills my motivation.
31
u/vindolin Sep 28 '19
Why not use something mature like QtDesigner or GTK Glade?
29
u/5Beans6 Sep 28 '19
Because I didn't know what I didn't know ¯_(ツ)_/¯
Which one is better for more simple things to get up and running quick?
6
u/vindolin Sep 28 '19
Good point :)
I did some internal tools with GTK (linux) and really liked it, but I think Qt is better for stuff that should run cross platform, especially OSX.
2
Sep 28 '19
Can I say that I disagree ? Because I do disagree. I have found pyGTK + glade to be insanely easy for Linux and windows (can't try on Mac ). While PyQt was complicated and not intuitive.
6
2
u/Username_RANDINT Sep 28 '19
/u/vindolin is right. I develop in GTK which is perfect for Linux systems, really nice toolkit. But it needs some extra work to be cross platform. Although it's quite easy to set things up in Windows as well lately.
5
u/Zouden Sep 28 '19
Possibly an unpopular opinion, but Qt is hugely inconvenient for just making a simple GUI. I find it requires jumping through a lot of hoops just to get to the same result as a Tkinter app. I'm sure it's great when you're familiar with it, but for casual use Tkinter is better.
1
u/import-username-as-u Sep 29 '19
You’re most welcome! It was built out of a personal hatred for building GUIs to be honest. I looked into a lot of other GUI-builders but couldn’t find something that could be used commercially and easily turned into an executable that could be shipped. I’m sure they are out there, I just didn’t find anything that I enjoyed using. So I built something!
2
u/allesfliesst Sep 28 '19
Check out PySimpleGUI. Love it for when I just want to slap together a GUI real quick.
10
u/clumsy_culhane Sep 28 '19
Are you taking contributions /u/import-username-as-u ?
I'm seeing a lot of little things that could be cleaned up that I'm happy to help out with, seems like a fun project!
1
5
u/QbaPolak17 Sep 28 '19
Any way to specify relative widget sizes? As in 50% of the width, 25% of the height etc?
Either way looks cool may take a look at it at some point
1
u/import-username-as-u Sep 29 '19
You can specify specific height and width in the widget resize tab. It also tells you the window size, so it should be simple math! But that is a good idea for a feature to add in the future!
1
u/QbaPolak17 Sep 29 '19
I was thinking more along the lines of avoiding hard coded heights and widths so the GUI could be responsive when you resize it
1
u/import-username-as-u Sep 29 '19
That’s handled automatically actually. It’s designed to build it to be responsive when you resize it. The window you build is just the initial window size when you launch the app which can also be changed in settings.
So if you set it up to be the pixel size of 50% it’ll auto resize to 50% when the window stretches
It actually uses the grid method but it specifies the columns and rows to each be 1 pixel in size. And then the backend auto-magically makes it all resizable. If you want to see how it works look at the MyPyWindow class in the source code!
1
4
u/dustractor Sep 28 '19
Yes, relx rely relh relw with the place() geometry manager. There's grid() pack() and place(). Unfortunately one of the best tkinter references was written by someone so opinionated that grid() was the shit that they barely even mention pack() or place() ... that was real helpful
Funny, IMO pack is way better for rapid development so if I wrote that article I would probably have left out grid()
1
u/trout-kilgore_trout Oct 14 '19
What is this ‘best tkinter’ reference you speak of?
I’ve just started using it a few weeks ago and I find the references and tutorials to be mostly crap. I had a hell of a time figuring out how to use it in an oop manner and passing variables between classes. It’s been mostly trial and error.
1
u/dustractor Oct 14 '19
I call it the 'infohost' one... lemme find the link...
OH CRAAHP
its been sunsetted, apparently.
https://bugs.python.org/issue37149
fuck this is a problem
1
u/dustractor Oct 14 '19
Whew lucky we have a wayback machine:
https://web.archive.org/web/20190203155416/http://infohost.nmt.edu/tcc/help/pubs/tkinter/tkinter.pdf
Better save that pdf
1
3
u/khuwazimator Sep 28 '19
awesome. now why didn't I do it? oh yeh because I am never as bright as everybody around. way to go dude. I think this would be useful to a whole bunch of peeps. This idea has legs.
1
u/import-username-as-u Sep 29 '19
I’m not anything special! Actually just a college student, so technically I’m not even a “real programmer” yet because I don’t have a piece of paper saying so! :p
5
u/MysticSoup Sep 28 '19
Correction - you ARE every bit just as bright as everyone else here.
Just not as self motivated as people like op
2
u/niggatronix Sep 28 '19
Nice! Does it happen to show live code updates? This would be really helpful to those who are learning Tkinter, so they can see how the code changes when they modify the GUI.
1
u/import-username-as-u Sep 29 '19
Kind of.. anytime you hit the save button inside the project the code will be generated. One of the things that isn’t implemented yet is the logic being able to be kept while changing the GUI. If you make the GUI, then go in and write some logic code for what this or that button does, then go add some more buttons. It will rewrite the entire project, and you’ll lose your logic code. Something to work on in the future. This project is just a baby at the moment. Barely even born, and I want to keep adding to it and making it more robust.
2
u/Nmvfx Sep 28 '19
This is an awesome idea and the execution looks great too!
1
u/import-username-as-u Sep 29 '19
Appreciate it! Looks can be deceiving, this is the first thing I’ve ever written and shared with the masses so hopefully it’s not full of a zillion bugs waiting to emerge
2
u/Hexalocamve Sep 28 '19
Dark theme when? Looks pretty good, it is simple and clean. I hope you will develop it further!
1
u/import-username-as-u Sep 29 '19
Hahaha dark theme is a while off! I have a lot of other features I’d like to add before that happens!
2
u/daneelthesane Sep 28 '19
Congratulations. You are the first person to post something that made me want to hit "Save".
2
u/import-username-as-u Sep 29 '19
I’m glad to help! A lot of people know how much of a pain tkinter can be, and after having to use it for an internship I have, I just got to thinking “there has to be a easier way!” I couldn’t find anything I liked that could be used free for commercial use, and I’d already built a big chunk of the project in tkinter so I figured why not build something?
209
u/PhoenixizFire Sep 28 '19
<insert Thanos meme>
I used the Tkinter to create the Tkinter
24
0
Sep 28 '19
[deleted]
3
u/PhoenixizFire Sep 28 '19
when someone has already posted the bright meme idea you had in your mind
Thanos : Impossible
9
4
u/paypaypayme Sep 28 '19
We heard you like GUIs. So we put a GUI on your GUI so you can GUI while you GUI.
1
u/AmehdGutierrez Sep 28 '19
Thank you for this. Im deff going to use this, this weekend
1
u/import-username-as-u Sep 29 '19
Let me know how that goes! It’s currently got terrible documentation which will need a lot of work, but after seeing the reception from the community (and getting my first ever award of any kind on reddit) I’m definitely going to keep improving and updating it
1
u/samuelcbird Sep 28 '19
This is amazing. I’m impressed! Tkinter can be infuriating...
2
u/import-username-as-u Sep 29 '19
Very much so. Damn scrollbars man. Swear they will be the death of me. Well.. not anymore!
1
u/jwnskanzkwk Sep 28 '19
This looks like an interesting project. I might contribute to it if I have some spare time
1
u/import-username-as-u Sep 29 '19
Would love any help you might want to give! Since it’s gotten so much attention I guess I’ll have to do the actual hard work of writing more documentation to make it more friendly to people who didn’t write the whole thing from scratch haha
1
u/Nishantc7 Sep 28 '19
I wish you shared this earlier ;_;
2
u/import-username-as-u Sep 29 '19
I tried. :( about a month ago I tried making an initial post on it, but my “reddit account wasn’t old enough” although it has gone through many improvements since then.
1
u/MasterOfArmsIsGood Sep 28 '19
thank you i hate tkinter
1
u/import-username-as-u Sep 29 '19
Would you believe me if I told you I hate it more? Project born out of hate for what exists to make it easier.
1
u/Albus70007 Sep 28 '19
How much did have you spent in this?
1
u/import-username-as-u Sep 29 '19
As of now probably somewhere between 100-150 hours. I never really kept track. It honestly started off as an experiment to see if I could even get drag and drop to work, but then once I did it kind of just morphed into something bigger.
1
u/Y45HK4R4NDIK4R Python 3.8.6 Sep 28 '19
Does it work for Linux/OS X?
1
u/import-username-as-u Sep 29 '19
It should but I haven’t tested it. All the path stuff is done using os path joins I believe, but I can’t say for absolute sure! Try it out and let me know!
4
2
u/DontForgetWilson Sep 28 '19
Looks pretty solid. There's been a lot of activity in the rust GUI story recently and I hope someone does something similar for some of the better frameworks that are emerging.
2
2
u/siliconcortex Sep 28 '19
I just barely started Tkinter making basic stuff and this heaven's grace arrives.
2
2
2
u/jhayes88 Sep 28 '19
Nice. I made a really nice GUI in QT Designer fairly quick. Never been a huge fan of Tkinter. I wonder if there's any advantages with this over QT Designer. QT Designer is actually pretty fast in terms of building stuff as well, just like this is, but there's also additional options in QT Designer like CSS customization and other stuff that's there if you need it. I'm not trying to shit on this because it still seems cool and you've obviously put a lot of work into it. I suppose this can be good for those wanting something slightly simpler than QT Designer and want to make something fast, and don't want to have to learn the ropes with QT Designer.
1
u/hilomania Sep 28 '19
I'm actually dealing with making a set of firewall deployment scripts more user friendly. (Right now only engineers are using these and it's a command line options driven thing. But we want to be able to have lower level users use some of the functionality. This might actually help with GUI building. I was looking at some JAVA stuff, but prefer python.
2
u/dustractor Sep 28 '19
If you are literally only trying to give users a button to run a specific command line, here's something that might work:
https://gist.github.com/dustractor/2130304dbe0f556073d36fe5c744b641
1
u/hilomania Sep 29 '19
Thanks for the link
2
u/dustractor Sep 29 '19
You're welcome. I made that last week in a work-induced haze so that I could have a sudo systemctl restart blah button. The version in the gist has an extra dependency removed for
keyboardwhich requires sudo but lets it have system-wide numpad hotkeys for the first 9 commands. I just thought I'd mention 'keyboard' package as one that might make certain users happy since there is really no need for the visible gui part.My goal with that project is to let the input be bracketed and have the deeper levels of parenthesis modulate horizonal/vertical packing
1
u/explodingman031 Sep 28 '19
It is difficult to compose GUI in tkinter, so nice work.. I always prefer building GUI with web technologies, but the drawback is large app size and a little bit of lower efficiency.
1
1
1
1
1
1
1
u/moazim1993 Sep 28 '19
Dude I was looking for something like this 2 years ago. Good for you, I hope this takes off.
1
1
u/tubamann Sep 28 '19
Thanks!! I've been looking for something like this, as it will save me many boilerplate hours. I'm a medical physicist making dozens of quick and dirty python tkinter GUIs. :)
1
Sep 28 '19
This is awesome! Tkinter isn't my favorite thing to use and is a bit confusing, so building something that makes things more visually simple is great to see.
1
1
Sep 28 '19
I wish you the best of luck. Visual gui builders have a long history of mediocrity because it is super hard to pull of. I commend your fortitude!
1
u/apv507 Sep 28 '19
This is awesome! I can't tell you how much code has been written and perfected only to be abandoned when it's time to skin it.
Text based programs are fine... Besides it makes me feel like a hacker.
1
1
1
1
u/savag1912 Oct 14 '19
I was attempting to use your application but am having issues. I was looking for a tool to do exactly this. Build quick simple GUIs for software we write that don't deserve dozens of hours of gui but a few buttons sure would make it more usable. The trouble is I can't get it off the ground at all.
I can't get the Demo or a simple gui I made to run from the command line. I made a simple 2 button gui with no logic. No changes to the python files at all. When I navigate to the project directory and run the __main__.py as instructed I get the following
Traceback (most recent call last):
File ".__main__.py", line 1, in <module>
from GuiBuilder.PROJECTS.Test1.MainGui import Gui
ModuleNotFoundError: No module named 'GuiBuilder'
I feel like I am mission something simple here but I get a similar error when I run the Demo. I my little test program to run from within your "MyPyBuilder" by doing load and then run. It works fine there. However not when I run it from the command line. I am assuming there is an issue with me running from that directory. I tried running it from several different locations with no luck. Any chance you can help out with this issue? I would really like to use your application.
Thanks in advanced.
1
u/knopke Mar 03 '20
When I started py gui, I was told this is not really possible. I love the attempt and will deffinetly check it out.
1
u/fraite Mar 24 '20
Just come across this, and I seem to have seen this rather late. I had the same feelings and ended writing something too. The results are here:
1
u/blueastheocean Sep 28 '19
You should really try pyqt
1
u/Rapante Sep 28 '19
Pyside ftw
1
u/blueastheocean Sep 28 '19 edited Sep 28 '19
Yes I agree in fact I use Qt designer in conjunction to pyside2
2
u/Rapante Sep 28 '19
It's so easy to make a GUI app that way. Only annoying thing is the overhead/low portability it implies.
1
0
0
0
-2
174
u/import-username-as-u Sep 28 '19 edited Sep 29 '19
All you have to do is pull it and run main.py
I like to think it’s intuitive and would love some feedback. It currently has support for Buttons, Dropdowns, InputFields, Labels, CheckButtons, SpinBoxs, and RadioButtons as well as Toplevels and scroll-frames/frames.
It generates a directory full of code that’s written to run your application and you just fill in the logic.
Button named “hi”
Generates def hi_button_fill(self): return “whatever the button should say”
def hi_button_click(self): print(“you clicked me”)
You have the power to do whatever you want. It just builds the GUI for you, and makes it resizable.
It’s built completely on builtins, so if you wanted to package your final product and turn it into a .exe that’s no problem.
Build a GUI, save the project, Fill in the blanks for the logic. You’re done!
https://github.com/TristenHarr/MyPyBuilder
Feedback appreciated! This took almost 100 hours to do, and it’s going to continue being improved and expanded on! I want to open-source it under an MIT license.
EDIT: This blew up. I was hoping people might take notice but I never expected this level of response! Thank you all so much for the encouragement! As of now I am hoping to expand the project and have ideas for a direction I want to take it. This is the first project I’ve ever written that I’ve actually shared, so I’m brand new to this. Anyone who has experience with open source software, or wants to contribute please message me!
EDIT: Detailed README is now up. Should explain just about everything you need to know to use this!