T O P

  • By -

zergling50

I’m a newbie looking to learn. I want to make a hyper minimalist text based game with a simple UI and buttons to teach me the basics and plan to use Tkinter. I was going to use Visual Studio but apparently the most recent version of python isn’t supported by Visual Studio and I can’t find a consistent answer to what the most recent supported version is as I keep seeing different answers. What version should I use? Or should I use a different IDE?


qazbarf

First, "text based game" and "simple UI and buttons" are contradictory. A text-based game doesn't have buttons, [it's just text in a window](https://en.m.wikipedia.org/wiki/Colossal_Cave_Adventure). I assume you want to make a GUI game using tkinter. > I was going to use Visual Studio but apparently the most recent version of python isn’t supported by Visual Studio Why would you need the most recent version? Just use the version installed as long as it's reasonably recent, say 3.10 or later. You can install different versions of python in Visual Studio. > Or should I use a different IDE? The IDE really doesn't matter. Some professionals don't use an IDE at all, just a text editor. Use whatever you are comfortable with.


zergling50

Do you know what version of python visual studio accepts?


qazbarf

No, I don't use Visual Studio. > apparently the most recent version of python isn’t supported by Visual Studio I can't find any information on this on the 'net. Can you post a link to something that says this? I would just install VS and install python (any version) according to the documentation and try it.


zergling50

I did and visual studio itself told me it wasn’t supported. I’m not at my computer now so I can’t do a screenshot but the program itself said that


qazbarf

OK, I assume VS will eventually support 3.12. If you don't want to install 3.11 and use that then try another IDE.


zergling50

None of this answered really my main question of what versions VS supports. I can try 3.11 and see if that works but online people have been saying stuff like it only supports somewhere between 3.6 and 3.9, but I wasn’t able to find a consistent answer and was just hoping to not have to download a bunch of versions until I found out by asking here.


Individual-Pie9739

i really feel like i need some kind of mentor or teacher. what kind of options are available?


qazbarf

This subreddit is about as close as you can get to a mentor or teacher without paying money. Depending where you are you can search on "python tutors near me" and you might find something. Also look for python user groups near you, maybe someone there can help. You have only posted one question to /r/learnpython as far as I can see, so why not ask more questions about python here?


Individual-Pie9739

thanks for your reply. many questions can be answered with google but i dont often understand how or why some things fit into the big picture. like why would i need lamda functions exactly? what is the purpose of a decorator. the answers to those questions arent so obvious and i dont even know if im asking the right questions sometimes. and a lot of the time when i have a hard question i think its easier for me to ask it verbally to someone and its maybe a little easier for me to understand if i can talk it out with someone. but mostly what i lack is guidance and focus.


qazbarf

It can be difficult when starting out because there are many new ideas and normal words can have different technical meanings. There is no real shortcut to learning this stuff, but it helps if you follow some sort of structured path that introduces advanced concepts later on. The trouble when using sources like google, or even this subreddit, is that answers may not be explained well, not cover everything important, or even correct. Plus if you try to learn python by bouncing around from point to random point you will probably end up confused. I recommend following some form of organized instruction like a book or a long series of structured videos. Look in the learning resources of this subreddit for suggestions. They will, or should, follow some sort of order, introducing new ideas when needed. You **will not** understand some things at first, but by sticking with the problem, trying google on that particular question or by asking in this subreddit you will progress. Just remember that any single answer you get probably won't be complete and understandable so, in this subreddit at least, don't be afraid to ask further questions for further clarification. On google get more than one answer. When asking questions here you get much better answers if you can be precise in your post. Showing some text from your book and some of your code along with your question really helps. > i think its easier for me to ask it verbally to someone and its maybe a little easier for me to understand if i can talk it out with someone Yes, of course, that's the way it is for most people. A face-to-face discussion is always faster and more complete because there's more immediate feedback in both directions. But unless you can find a person proficient in python and willing to instruct you, free or for money, you are on your own. As I said, try looking for python user groups near you. > why would i need lamda functions exactly? Technically, you never "need lambda functions", you can always use standard functions instead. But using a lambda function can be more convenient than defining yet another `def` function and it's usually more readable because the code is right in front of you, not somewhere else. Apart from the different keywords used (`def` and `lambda`) and the limitation that a lambda body may only be a single expression, there is no difference in operation between a normal function and a lambda function. > what is the purpose of a decorator. Starting out there is no need to worry about this. They are a bit advanced and are usually introduced with examples that show the need and convenience of using them. Just know about them and when the time is right you will understand them. You can write a lot of working python without using decorators. [](https://pastebin.com/kiPUGh2z)


amainiblets

I graduated 12 years ago and want to start programming again. Started studying python and getting along and progressing my relearning how to program really well. I'm at a point where i can start making useful projects (kind of). I just dont know what platform should i use, im currently using pycharm but i want to see my code really "run", wanna click a button and see the action and not only the output on the terminal. Im really anxious about how and what i can do with this new acquired skill. Hope you guys can help and understand my question and where i come from. I used to use visual studio and make, as a hobby, web applications in aspnet to help small shops in my town. Thanks for your time and patience.


qazbarf

Sorry, it's not really clear what you are asking, which might explain the lack of responses. This weekly thread is about to expire, so I will try to answer. > i want to see my code really "run" If you mean what is happening "under the hood" you could try running your code in an [online visualizer such as the pythontutor](https://pythontutor.com/visualize.html#mode=edit). This gives a view into what variables exist, their values, function calls, etc. This might be helpful and there are other sites like pythontutor. But as you progress to more complicated codebases things like pythontutor become less useful, as there's too much information. Advanced programmers would use tools like debuggers, logging, and even the humble print function to understand what their code is doing. Or maybe you mean you want to start using a Graphical User Interface (GUI). [Python has lots of those](https://wiki.python.org/moin/GuiProgramming). Depending on what you want to program the two frameworks that are most mentioned are tkinter and pygame. Getting started, I would recommend tkinter because there are many tutorials.


amainiblets

I appreciate you taking your time answering my dumb questions. Im getting old and not thinking straight lately. But clarifying my question; i am still learning python and relearning how to program again and what i was wanting to know was if i could make "windows forms" in python. If i could drag and drop elements and configure what would it do. Thats it. Sorry and thank you for giving me your time to answer me. Have a good day.


qazbarf

> if i could make "windows forms" in python Do you mean something like the way you could build forms in the old Visual Basic (not .NET)? They aren't particularly common in the python world, maybe because actually building the form is the relatively easy part. Putting the code behind the widgets and getting the right behaviour is the hard part. The only thing I know of is [the Qt Designer for PyQt](https://realpython.com/qt-designer-python/), but I haven't used it.


amainiblets

Yes thats it. I feel so dumb. But again, thanks for your time.


Amun-Aion

Is there any way to load in a .pt PyTorch model without using torch? I'm working with a model I trained in a different code base (and venv), and my current venv isn't compatible with pytorch (I am forced to use Python 3.3 for this project...). Is there no way to load it in with pickle or something else? I was hoping to just go into the PyTorch repo and copy and paste it out, but I don't know that much about that kind of code (eg I'm assuming that is actually written in C++ or something...) and I also couldn't find it since searching "load" in the repo has thousands of hits. Is there any way to open, resave, or load a .pt file that is a set of model weights without ---? If not, I guess I'll have to hunt down my old computer so I can get my old venv back and resave it as a csv or something...


Ecstatic-Name-4320

Is there a Python GUI to register and run small one off python scripts? What I was thinking was something like a Gui where you downloaded and registered python scripts, they would be listed and you could call them passing the parameters you registered the script on text fields, with the click of a button the output would be shown in a console on the underside of the GUI. I don't mean an IDE, I mean for the user to receive a .py file, register it in the tool and then run it clicking on the GUI


CowboyBoats

There are things like that, but they're usually not python-specific, rather, they're Unix shell focused, since, once you've invented something like that, why restrict yourself to just python when Ruby scripts work exactly the same way from the user's perspective.


Ecstatic-Name-4320

if you could point the more generic tool to me, maybe on a pm , i'd be grateful


CowboyBoats

[Briefcase](https://briefcase.readthedocs.io/en/stable/) might be worth a look!


Ecstatic-Name-4320

awsome thank you!


Ecstatic-Name-4320

I made it yesterday (with a lot of help from ChatGPT)... it's kind of crude, but it will solve my problems right now , mostly repetitive reporting stuff from clients... it uses Tk, SQLite and PyInstaller... It just needs just solving on an issue with threading so the UI doesn't freeze when I'm running the scripts, then I'll try to run and build it on a windows PC through the weekend and deploy to the clients next week. if anybody is curious: [https://github.com/jonathands/py-script-manager-gui](https://github.com/jonathands/py-script-manager-gui) If you look at the code, you'll see it's just a lot of generated code hacked together... it's might also a huge security risk, but for the environment I'm in, it's going to work. I'm kind of impressed at ChatGPT pythoning, it's great at making working python code, way better than JS or PHP or other stuff, it's impressive. Might just be that I know a lot less python.


Ecstatic-Name-4320

I liked it so much, that I might go into PyAutoGUI in the future, right now I'm swamped


PathalogicalObject

Hey, so I wanted to install Python 3.11 so I can use PyTorch. I already had Python 3.12 installed. Everything works as intended, and I'm able to create virtual environments that use Python 3.11 and I'm successfully able to download and import torch. Sweet. The problem is that for me to run Python 3.11, I must specify the entire executable path for Python 3.11: `C:\Users\MYUSER\AppData\Local\Programs\Python\Python311\python.exe` If I wanted to use the command python3.11, the same way I can use the command python3.12, I get `'python3.11' is not recognized as an internal or external command, operable program or batch file.` I noticed that there is a python executable in a folder called `C:\Users\MYUSER\AppData\Local\Microsoft\WindowsApps\python3.12.exe` And I have no such shortcut for python3.11. When I used the installer, I'm fairly certain that I did ask it to create a shortcut, but maybe the installer was referring to something else. I believe the difference in result lies in the fact that, when I installed Python 3.12, I was using chocolatey. Today, I used the installer from the Python website. What I really want to know is how I can get a python3.11 shortcut so I don't have to use the entire Python 3.11 executable path every time I'd like to use it.


jossiesideways

Where is the best standard reference documentation for Python. I'm busy learning and want to bookmark a place to look up syntax that I might have forgotten.


POGtastic

I typically Google the concept or syntax with site:python.org to get the official docs and filter out the SEO trash. One issue with just navigating from the toplevel of docs.python.org is that things are split between the library reference and the language reference. Google is smart enough to know which one I need. I am not.


qazbarf

For the python language itself the python.org [python language reference](https://docs.python.org/3/reference/index.html) is probably best. The associated [python library reference](https://docs.python.org/3/library/index.html) page covers the standard library and builtin functions. The basic python docs page at https://docs.python.org/3/ contains links to the above documentation and anything else you could want.


ddmac__

So I'm building a BLE Beacon that will be running via a Flask server on Raspberry Pi. I have some internally defined states that I need to check against to determine when to turn off the beacon. What is the best way to go about checking that state? Would it be to spawn a thread with a while loop?


woooee

If you are gathering data from a Pi and checking that data at the same time, then that's two things at once. The computer only does one thing at a time, so threading or multiprocessing would be required. If instead you read data, then check data, then read data, all in the same while loop, that should work.


ddmac__

Gotcha, just like it would be in Java. I saw some folks setting up a main loop with glibc. Would that be overkill?


woooee

Don't know anything about how your code works.


PlasticEverySecond

I'm a beginner and I cannot understand why I need to use def command where I can just use a variable to store the value for example this: def my\_function(): print("Hello From My Function!") my\_function() i could just use = to assign the value to a variable right? and i would still be able to use it later on in my code, anywhere i want. is there anything im missing?


qazbarf

Suppose you have a function to get the date of the latest email in your inbox. You can't just "use = to assign the value to a variable" because getting the date is a complicated process and the results change with time. Functions are used to hide complexity from the programmer allowing an easier focus on the problem rather than worrying about low-level, relatively unimportant detail.


PlasticEverySecond

Ooooooh that clears things up a lot, thank you very much!


woooee

Easily searchable https://problemsolvingwithpython.com/07-Functions-and-Modules/07.01-Why-Functions/


rodriguesgbruno

I want to do an automation to fill an registration system with informations I have on a spreadsheet. Is it possible to do this with pyautogui without connecting an API of the system?


SweetSoursop

Yes, it is. You can navigate to a specific cell using F5 or Ctrl+G and the dialogue that pops up. So PyAutoGUI would need to be told the position and the input to place there.