Using wxPython within Sublime Text 3 - python

I am using Windows 10
I wish to use wxPython as a GUI for my Python3 programs. I am using SublimeText 3 to write and launch my scripts
When I launch my script from within Sublime the program runs but the wxPython window does not open. It opens as expected if I run the program from the cmd prompt.
My internet searching leads me to believe that Sublime is suppressing the window from opening and that this behavior can be changed within Sublime's settings, but I can only find instructions for Sublime Text 2.
How can I prevent Sublime Text 3 from suppressing the wxPython window?

If you are using Windows, the correct extension would be *.pyw. Change the name of your WX Python script changing the extension ".py" for ".pyw" and try to run it from ST3.
Good luck.

Related

Blank python IDLE window when opening python file on macOS

For some reason, whenever I try to open a python script that has around ~450 lines of code, IDLE's windows simply appears empty and when I try to run it doesn't run anything either... However, if I try to run a smaller program it works for some reason. Does anybody know how I am able to run a python script on my Mac besides IDLE or how to fix the IDLE window being blank whenever I open a file?
To learn how to run Python Python programs on a Mac, read Chapters 1 and 4 of Python Setup and Usage. Running from an IDLE editor is just one way.
IDLE uses the tkinter module which wraps the tcl/tk GUI framework. Did you read and follow the instructions of how to replace the buggy tcl/tk that Apple supplies? Read the entire page before starting! Ignoring this page is the most common reason people have problems with IDLE on the Mac. There are a few others, but I do not remember one that matches your description.

Run terminal inside VS Code for python script?

I'm on Linux Mint running VSCode and I was somehow able to run a terminal not as a separate window but right below an open Python file. Seems to be easy on Win/OSX (Ctrl/Cmd+J and select Terminal tab) but not specifically a feature that I can choose when I'm on a Linux machine. Any special keys to bring it back?
In general, Ctrl-` opens the integrated terminal in VS Code. Otherwise look under the View menu for the Integrated Terminal option. If you're looking for Python-specific options, there are Run Python File in Terminal and Run Python Selection/Line in Terminal commands from the command palette.

How to clear the console in sublime text 3 when running a new script?

I am trying to customize sublime text 3 for Python development. Is there a way to set my buildsystem to clear the console before running a script? Also, I would like to have my console opened by default when opening a new session. I'm using Windows 10.
Install ClearConsole package in sublime, then type alt+k to clear then console.

How do I open Python IDLE (Shell WIndow) in WIndows 10?

I am just starting to learn Python and I am using Windows 10. I downloaded and installed Python 3.4.3. But everytime I open Python from my Desktop or from C:\Python\python.exe it just opens a black command prompt without any Menu options like File menu, Edit Menu, Format Menu etc. I can't see any colors of the code, it's just black screen with white text. I searched about it on internet and came to know that what I am opening is the Editor winodws and I need to open Shell Window in order to have access to all of those options and features. I can't figure out where is the .exe of Shell Window and with what name is it? Please help me.
P.S. I also tried to open pythonw.exe that was present in the Python folder where it was installed, but nothing opened.
In Windows you will need to right click a .py, and press Edit to edit the file using IDLE. Since the default action of double clicking a .py is executing the file with python on a shell prompt.
To open just IDLE:
Click on that. C:\Python36\Lib\idlelib\idle.bat
Start menu > type IDLE (Python 3.4.3 <bitnum>-bit).
Replace <bitnum> with 32 if 32-bit, otherwise 64.
Example:
IDLE (Python 3.6.2 64-bit)
I agree with one who says:
just type "IDLE" in the start-menu where it says "Type here to search" and press [{ENTER}]
If your using Windows 10 just type in idle where it says: "Type here for search"
My solution to setting options and then invoking Idle on a python script is:
Set optn=blah
...
Set optn=blah
start pythonw C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36-32\Lib\idlelib\idle.py STFxlate.py
This allows you to setup the environment prior to invoking idle.
This assumes that pythonw is in the current path
For those using Anaconda, type idle on windows search bar ("Run or Execute command"). This probably wont work if you didn't install anaconda with environment variables. You can also go to
Anaconda3 folder > Scripts >idle.exe
and create a shortcut to you desktop.

Change Linux terminal font type using python

is it possible to switch the font type for the Linux terminal using python 3? There are threads about the windows console:
Change console font in Windows
I try to build an application which runs on standard Linux terminals like Xfce or gnome terminal or terminator for example. Changing text color and background is easy. But for switching the font type I found no solution.
I think I could write a script that defines terminal layout at startup, but that wouldn't run for different terminals. Terminator has it's own config files and other terminals, too.
Maybe this link helps you1. It shows several ways of coloring your shell. So you can but this in the call of your shell from python.

Categories