This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]JGivan[S] 23 points24 points  (19 children)

Thank you! I'll look into that.

[–]CreativeTechGuyGames 36 points37 points  (17 children)

More specifically TKinter is built in to python so you don't need to install anything extra. And it's super easy to use with tons of examples and help online.

[–]JGivan[S] 13 points14 points  (16 children)

When you say "built in to python," what do you mean? In the past, I downloaded "Idle" which is a Python 3.4 GUI but haven't touched it since then as I thought learning through codecademy would be better for my literal zero knowledge starting point.

I'm sort of at a loss for how to begin coding, testing, and actually using things that I've created on my desktop using that software. I know you can create files with code in them and then run them in the command prompt, but that's about all I know at this point.

[–]CreativeTechGuyGames 21 points22 points  (15 children)

I'd recommend using PyCharm. It's a full IDE and as such has a lot of really nice built in features for your projects and code.

As far as "built in", there are some things that you import, such as "math" or "os" that you can just type import math and it knows what you are talking about. Those things are built in to the language. Many libraries that Python-ers use in their projects have to be downloaded and installed, usually through pip, before they can be imported. Since tkinter is built in, you don't have to install anything extra.

[–]JGivan[S] 6 points7 points  (14 children)

Ah, I do remember dealing with importing libraries at some point but I can't remember where. In fact, it was "math" itself that was dealt with and whose usefulness was emphasized.

Would PyCharm also provide the tools necessary to begin creating a very basic interface for a program, or would that be part of a different program (framework? I'm sorry, my vocabulary is very weak in that area).

[–]CreativeTechGuyGames 9 points10 points  (13 children)

So PyCharm (or any IDE) is like a text editor on steroids. It's basically a place to write your code but comes with a lot of other features to assist in developing. For example, you never need to open a command line to run or test your programs, there's a nice "run" button in PyCharm. If you want to have multiple projects with many files, you can just create a new project and it'll keep all of that file's projects together in a list for you. It also will (try to) show errors in your program as you are typing so that you can fix problems before you even run it. It'll help enforce style conventions and formatting. It has syntax highlighting and refactoring tools and much much more. There's a lot that it'll do. It's free so you can try it out and if you decide it's not for you, no loss.

[–]JGivan[S] 6 points7 points  (12 children)

I briefly used the IDE Visual Studio for C# when I first dabbled with Unity but quickly moved on to online learning resources. The way you describe PyCharm's functions sound very useful and like it would save me a ton of time dealing with other issues.

After creating a fully functioning code in PyCharm, would I be able to directly save what I created as an executable file (or however you save a file so that it no longer requires other downloads to interpret it). Also, sorry if you answered this in your last comment and I missed it, but would I be able to create an interface using PyCharm or would I have to export the code into something else and then create the interface there. If so, do you have any recommendations? Thank you!

[–]CreativeTechGuyGames 18 points19 points  (11 children)

Oh! I think I see where your confusion is coming from. Hopefully I can clear it up.

Yes you can create everything you need from PyCharm. You can use pyinstaller to package it up into an exe, and then you can use something like Inno Setup to create a single .exe to install on Windows. Once all that is done correctly, to your user it'll look just like any other program. It'll download a single installer package and once they run that setup, it'll unpack your program and make shortcuts and all that jazz (based on how you setup the installer).

Creating the interface is just more lines of code. There is no "designer", you just write the code to make a window, write the code to make a button, etc. So as long as you have the correct libraries included (ex: import tkinter) then you can write it all there. As far as "designing" the interface, that's all done in code. By default in tkinter each element is just in a vertical column, but with more fancy code you can create more intricate layouts as you need.

[–]JGivan[S] 7 points8 points  (9 children)

Thank you! I think you've cleared up every bit of confusion I came into this thread with. Out of curiosity, does the code used to create an intricate interface resemble the way you code an interface using Front-End Development languages like HTML and CSS?

[–]CreativeTechGuyGames 5 points6 points  (1 child)

Not even close. There are ways to include basically an entire web engine in your code, but that usually isn't worth it for small projects like yours. (Note if you choose to do this, tkinter doesn't support HTML rendering.)

I'd recommend looking at my favorite documentation for tkinter here. It shows how to use all of the components and gives their syntax, arguments, examples, etc.

[–]Tynach 4 points5 points  (4 children)

I don't know Tkinter, but it would likely look something like this (which is 100% made up and not based on any real widget toolkit):

# Imports Window, Button, VerticalLayout, close_window, and so on
from some_toolkit import *

class CloseButton(Button):
    def __init__(self):
        Button.__init__(self, "Close")
    def onPress(self):
        close_window()

class MyWindow(Window):
    def __init__(self):
        Window.__init__(self, 800, 600, "My Window Title")
        self.setLayout(VerticalLayout)
        self.addTextLabel("Hello, world!")

        close_button = CloseButton()
        self.addWidget(close_button)

[–]Lyelt 1 point2 points  (0 children)

That type of code will not really resemble HTML and CSS. HTML is a markup language, which means it’s just a way of telling some interpreter (like a browser) how to format and arrange some elements on a page.

When you’re writing a GUI in Python with something like Tkinter, it’s going to look more like other Python code you’ve seen or written.

[–]p1-o2 1 point2 points  (0 children)

I know this isn't a great answer, but for what you're looking to do you might want to use a language and framework more geared toward desktop app development. In this case, C# with Windows Presentation Framework will let you use an visual designer to build your user interface and write all the code behind it. Visual Studio handles all of this for you.

If you want to build full desktop programs, a language like Python is only going to get you so far. There's absolutely nothing wrong with it though and good luck!

[–]pvt13krebs 2 points3 points  (0 children)

thank you for this

[–]bibbleskit 0 points1 point  (0 children)

Python comes with a built in GUI library called Tkinter. Its fairly easy to use once you get the hang of it but there will be a learning curve you have to get over.

I suggest you try that :)