Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UI framework?
#1
Hello,

I'm essentially being forced to use Python, despite VBA clearly being the right way to do this little project (and significantly easier), but maybe I'll be able to actually get Python to do something productive and not hate it as much if I can.

If you're still with me, I thank you for your patience.

The project is super easy, conceptually.

I need a UI for 5 different users on Windows desktops, with 12 text entry fields (up to 50 characters) and 2 combo boxes (or other widgets where they can select prewritten text). The UI needs to have 1 button, to submit the contents of each box to a SQL server table, which is already set up.

I was going to try to do it as a web page in html/javascript, but since I am not permitted to load or run anything server side, that's out. I thought maybe I'd give Python another go, but failed miserably after 9 hours of fiddling. It really should be incredibly easy to create a script and convert to an executable that I can distribute, or to a web app.

I tried using Flask, but literally every line I typed thew some cryptic error. So I found some tutorials on Tkinter, and it seems a little less unforgiving... but creating a combo box/drop down, in the examples I found, were 25-50 lines of code. Ridiculous (and aesthetically horrible, but that's probably because I haven't gotten far enough into the tutorials).

I've tried using Spyder, Pycharm, Visual Studio, and settled on Sublime Text 3 because my peers all use it for their heavy lifting.

So - I guess the question is - what is the easiest framework (if not Tkinter or Flask, what else is out there?) and IDE? I'm so used to the simplicity of VBA that designing a UI using only text is extremely frustrating. But I can't find anything remotely usable for Python.

Thanks for any input.

And yes, I know my attitude is awful. Python has been a huge thorn in my side for years. I even have it mentioned in my pre-ordered headstone and obituary.
Reply
#2
top GUI frameworks
http://insights.dice.com/2017/08/07/7-to...or-2017-2/

The IDE doesnt really matter. It is just a glorified text editor. You can make any IDE point towards any python interpreter you wish. You dont install to the IDE, you install to python. Then you point the IDE to that python. python comes with its own 3rd party installer/handler pip

Quote:So I found some tutorials on Tkinter, and it seems a little less unforgiving... but creating a combo box/drop down, in the examples I found, were 25-50 lines of code.
You would have to show us the code. A simple drop down shouldnt be that much code, example below.

import tkinter as tk #python3.x
#import Tkinter as tk #python2.x

root = tk.Tk()
variable = tk.StringVar(root)
variable.set("one") # default value
w = tk.OptionMenu(root, variable, "one", "two", "three")
w.pack()
root.mainloop()
You can make tkinter look better via ttk. If you run this code you get an drop down menu to choose between different themes.
Recommended Tutorials:
Reply
#3
for GUI languages, see: https://wiki.python.org/moin/GuiProgramming
most popular seem to be Qt (pyqt5) and wxpython tkinter (built in) is fine for relatively
easy applications, but the geometry manager can sometimes make you pull your hair out.
Reply
#4
My apologies for wasting your time - I tried to remove the content of the post, and requested that the post be deleted entirely a few minutes after I submitted it.

I'm going to give it another shot today, if my blood pressure stays in check long enough.

Thank you for the combo box code - that is clearly much simpler than the numerous examples I found online.

The glorified text editor does make a difference for people who don't know the language. A huge difference. Without intellisense or type ahead, or whatever it's called in python, how do you know what methods (events/actions/not sure) apply to a widget or variable? I've been through a bunch of them (to the point that my PC has had to be re imaged from all the residual crap that gets left behind after uninstalls) and am yet to find one that works for me and other entry level people like myself. But I'm quite anxious to check out the dice link and Qt(pyqt5). Maybe one of them will finally get me over the hump.

Thank you again, and have a great day.
(And I really will try not to post here again - like I said, I tried to have my post deleted before anybody spend any effort on it)
Reply
#5
Also, and I thank you again for your help, and I'm sure it works perfectly on your installation, but for me, I get this error

AttributeError: type object 'Tk' has no attribute 'StringVar'
Reply
#6
(Sep-21-2017, 12:08 PM)JP_ROMANO Wrote: A huge difference. Without intellisense or type ahead, or whatever it's called in python,
The are editor with IntelliSense for Python like VS code.
I use VS code really impressed bye it,have quick review here.
PyCharm Free Community also have good autocomplete and code inspections.
 
JP_ROMANO Wrote:AttributeError: type object 'Tk' has no attribute 'StringVar
Are you using Python 2 or 3?
That code should work for both just uncomment.
Have you changed code capital letters TK?
Reply
#7
snippsat - thanks
I have Microsoft Visual Studio and have tried that, but it's really, really heavy and confusing. Will give it another go.

As for the version, I have Python 3.

I haven't changed a THING but now I'm getting a new error:
ImportError: No module named 'Tkinter'

I sincerely appreciate your time and input, but please don't waste any more of your time. I think the better approach would be for me to hire a consultant to do the project and see if I can understand the code when it's up and running, then tinker with it as needed.
Reply
#8
(Sep-21-2017, 12:45 PM)JP_ROMANO Wrote: I have Microsoft Visual Studio and have tried that, but it's really, really heavy and confusing.
VS code has nothing to do with Microsoft Visual Studio.
VS code is a stand alone and light weight editor.
JP_ROMANO Wrote:I haven't changed a THING but now I'm getting a new error:
ImportError: No module named 'Tkinter'
If you start cmd and type python what to you get.
example:
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. Med enerett.

C:\Windows\System32>cd\

C:\>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
>>> exit()

C:\>
Reply
#9
I get
Python 3.5.1 |Anacondea 4.0.0 (64 bit)

in Sublime Text 3, when I run this
import tkinter as Tk
root = Tk()

I get
TypeError: 'module' object is not callable

But really, you don't need to spend another second looking at this. I've asked a moderator to just delete this thread (twice) - since it will really have no value to anybody, and I don't want people wasting their time on me when people who can actually use Python need help.
Reply
#10
(Sep-21-2017, 01:16 PM)JP_ROMANO Wrote: But really, you don't need to spend another second looking at this. I've asked a moderator to just delete this thread (twice)
That's okay no need to continue anymore here,if you have any more question feel free to make new thread or continue here.
We will not delete thread as long as someone has answered in it,this thread can have value for someone.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020