Embedding ICO Icons in Tkinter

Embedding ICO Icons in Tkinter Although Tkinter is fairly basic, it is still quite convenient when developing some graphical gadgets with Python. Since the native icon is rather plain, a custom icon is generally chosen instead, but then a single-file executable program also has to be shipped with an ICO file to display the icon, which is undoubtedly cumbersome. This article describes how to embed the icon into the executable file. ...

2023-10-30 · 1 min · 3rd

What Is Reflection in Programming?

What Is reflection reflection ’s human ’s , has ’s . Digestcalculate, among them, has as follows:code: 1 2 3 4 5 6 if selected_algorithm == "SHA-512": algorithm = hashlib.sha512() elif selected_algorithm == "SHA-256": algorithm = hashlib.sha256() else: algorithm = hashlib.md5() code is userchoose ’s Digestcalculateway,Creating ’s object,very ’s method. but is has ,cannotmore?reflection: 1 2 3 4 if hasattr(hashlib, selected_algorithm): algorithm = getattr(hashlib, selected_algorithm)() else: algorithm = hashlib.md5() a kind of Digestalgorithm,program,;Usingreflection, can runtime,choose ’s string ’s methodcall. ,cost is ?cost is someefficiency. Java has Usingreflection, for example, ’s Spring. ...

2023-04-11 · 1 min · 3rd

Using External Tools in PyCharm

Using External Tools in PyCharm This thing is really handy, especially for packaging with pyinstaller — one-click packaging, no need to keep typing commands. Steps 1. Getting Started Open Settings, find the External Tools option as shown in the figure, and open it. Getting Started 2. Create a New External Tool An external tool is a set of predefined commands. When you use it, macros are replaced based on the file to produce the final command, which is then executed automatically. In short, it saves you the time spent typing commands — a few mouse clicks and the pyinstaller command is invoked to package your script. Let’s take that as an example below. ...

2022-10-07 · 2 mins · 3rd

The yield Keyword in Python

The yield Keyword in Python This article avoids heavy jargon and introduces the topic in plain language. If you have any hardware development experience, you may already find the yield keyword familiar — it behaves much like an interrupt on a microcontroller. 1. What is yield? As a software developer you are probably well acquainted with return: it terminates a function and passes back a value. yield does something similar — it suspends a function and passes back a value. Note the word suspends; that is the key difference. You can resume execution right where it left off (i.e. at the yield statement) by calling the next method. Sound a lot like a hardware interrupt? ...

2022-02-18 · 2 mins · 3rd