Python Code Notes

Information by python engineer

【tkinter】解像度を調整する方法【Python】

tkinterでアプリを作成した際に、PCシステムとtkinter画面の解像度と一致していないと文字がつぶれてしまいます。 表示をクリアにするために、Python側でシステムの改造度を取得・設定する方法を示します。 【スポンサーリンク】 (adsbygoogle = window.adsb…

デスクトップ上ショートカットアプリの紹介【Python】

Pythonで作成したデスクトップショートカットツールを紹介します。知り合いに提供したところ評判が非常に良く、デスクトップ画面がすっきりして、日々の業務効率が非常に向上したと報告をもらっています。 【スポンサーリンク】 (adsbygoogle = window.adsby…

【tkinter】アプリ起動時に画面を指定位置に移動させる方法【Python】

tkinterでアプリを作成すると、起動時に画面が出現する位置を指定したいケースがある。ここでは、ウィジェット出現時に発生するMapイベントを利用してアプリ起動時の画面位置を設定する方法を示す。 【スポンサーリンク】 (adsbygoogle = window.adsbygoogle…

【tkinter】画面をモニター端に自動で移動させる方法【Python】

以下の記事では、既知のサイズのtkinterメイン画面をモニター端に移動させる方法を示した。今回は、メイン画面のサイズによらずに自動でモニター端に移動させる方法を示す。 www.python-beginners.com また、アプリ起動時に画面を移動させる方法は以下の記事…

【tkinter】ウィジェットをドラッグで移動させる方法【Python】

ウィジェットをドラッグで移動させる処理の例を示す。 【スポンサーリンク】 (adsbygoogle = window.adsbygoogle || []).push({}); 以下の例では、B1-Motionイベント(ウィジェットをマウス左ボタンでドラッグしたときに発生するイベント)を利用してボタン…

【tkinter】マウスポインタをウィジェットに重ねたときに処理を実行する方法【Python】

マウスのポインタがウィジェット上に位置した際に特定の処理を実行する例を示す。 【スポンサーリンク】 (adsbygoogle = window.adsbygoogle || []).push({}); 以下の例では、Motionイベント(マウスがウィジェット上に位置したときに発生するイベント)とLe…

How to change a tkinter's widget color on or off hover

You can change widget color when on or off hover by binding "Motion" and "Leave"event to color change functions. This is an example using button widget. how to change tkinter's widget color on hover off hover on hover

How to create a simple dialog by yourself

If you want users to input something, you can use the tkinter.simpledialog module. But if you want to create a more complex or well-designed dialog, you can easily create one yourself. example example of a simple input dialog

How to "Just fit" tkinter main window to your display

Summarized how to just fit tkinter main window to the display edge. Normally the tkinter window is positioned slightly to the right of the position set using geometry method. You should take care if you want to just fit the window to your …

【django】ログインした状態のテストを行う方法【Python】

ログインした状態の動作をテストする方法を整理した。 TestCaseクラスのclient.force_loginメソッドを使用することで、ログインした状態でのテストを行うことができる。 from django.contrib.auth import get_user_model from django.test import TestCase f…