Giter VIP home page Giter VIP logo

for_pycon_shizu's Introduction

for_pycon_shizu

Pythonでデスクトップアプリを簡単に作る方法のcfpよう

当日のスライド

example の中身

examle配下にはデモで使ったファイルがあります。 試す際は99_Python_Script_Launcher.pyを実行するとランチャーが立ち上がるので便利かと思います。

  • 01_tk_sample.py
  • 02_tk_sample.py
  • 03_basic.py
  • 05_graph_sample.py
  • 07_vba_excell_join.py
  • 08_asci_img.py
  • 99_Python_Script_Launcher.py

01_tk_sample.py

tkinterを使ったサンプル。 こちらのコードは以下のサイトのコードを使用しました。

sample1

実行ボタンをクリックした結果

sample2

02_tk_sample.py

tkinterを使ったサンプル。

  • 実行結果

sample3

実行ボタンをクリックした結果

sample4

03_basic.py

02_tk_sample.pyをPySimpleGUIを使って書き直したサンプル。

  • 実行結果

sample5

実行ボタンをクリックした結果

sample6

04_graph_sample.py

公式のグラフのサンプル( https://pysimplegui.trinket.io/demo-programs のGraph Element)を一つにまとめてボタンで切り替えるようにしたもの

実行結果 graph_example

07_vba_excell_join.py

公式のVisual Basic Mockupを元にレイアウトを追加、機能追加したもの

実行結果 vba_result

08_asci_img.py

公式のDemo_Img_Viewerを参考にアスキーアートを自動生成する にGUIをつけたもの

実行結果 asci_result

99_Python_Script_Launcher.py

公式のDemo_Script_Launcher.pyを元にPythonファイルを実行、Vscodeで開くようにしたもの

  • 実行結果

sample1

Pythonファイルを実行した場合 sample2

公式のサンプルについて

スライドの中で紹介したものは公式の以下のサンプルになります。

matplotlibとの連携

https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_Matplotlib.py

グラフのソートアニメーション

https://pysimplegui.trinket.io/demo-programs#/graph-element/visualizing-sorts

CPUのリアルタイムアニメーション

https://github.com/PySimpleGUI/PySimpleGUI-Rainmeter-CPU-Cores/blob/master/PySimpleGUI_Rainmeter_CPU_Cores.py

PySimpleGUI-exemaker

https://github.com/PySimpleGUI/PySimpleGUI/tree/master/exemaker

for_pycon_shizu's People

Contributors

okajun35 avatar

Stargazers

PySimpleGUI avatar  avatar nikkie avatar  avatar  avatar

Watchers

James Cloos avatar  avatar PySimpleGUI avatar

for_pycon_shizu's Issues

[Suggestion] 4.py - drop the named parameter `default_text`

[sg.Text('名前', size=(15, 1)), sg.InputText(

The first parameter to InputText (by the way it can be shortened to Input, In, or I) is and will always be the default text to show. Thus, it is safe to leave off the default_text= portion. I would recommend using this statement as it is still simple to understand.

It's not a big deal, just a suggestion. The rest of this program is good. It's using the latest constructs.

sg.InputText('○○〇×××', key='-USER-NAME-')

[Suggestion] 3.py Use latest coding conventions, don't use size parameter if not needed

I was looking at example 3.py and see a number of problems with using this as an example.

This is a corrected version that I would recommend.

import PySimpleGUI as sg

sg.theme('Dark Green 6')

layout = [[sg.Text('Please click the button', key='-TEXT-')],
          [sg.Button('実行ボタン')]]

# ウィンサイズはsizeに(縦の大きさ,横の大きさ)で記載
window = sg.Window('show input text', layout)

# イベントループ
while True:
    event, values = window.read()
    if event is None:
        break
    if event == '実行ボタン':
        update_text = "Button clicked."
        # 表示内容を更新する際はウィジェットに指定されたkeyの値に.update("文字列")を入れることで可能
        window['-TEXT-'].update(update_text)

window.close()

I'll address each of them. Don't use the shortcut Submit and change the text. If you're making a button with custom text, use Button. The point is to teach people how to make a Button rather than how to modify a shortcut like Submit. Submit is nothing more than Button("Submit")

[sg.Submit(button_text='実行ボタン')]]

"Chained" calls are no longer recommended and have been removed from all documentation and demo programs. Specification of layouts is now done as the second parameter to the Window call, title is always the first.

To keep the code looking and feeling simple, put the parameters in their correct locations and drop the use of keyword arguments.

I'm confused as to why a size is being specified in this window. Unlike tkinter, Qt, etc, PySimpleGUI sizes the window for you. You do not need to manually specify a size. Keep the program examples as simple as possible. If you are intentionally wanting to show the use of the size parameter, then come up with an example where it's needed and explain why.

window = sg.Window(title='show input text', size=(200, 100)).Layout(layout)

I like the other changes you've made, in particular the use of window[key]

One way to explain this expression window[key] is that it look just like a dictionary lookup looks. When you find something in a dictionary you specify the key inside of [ ]. Here the "Window" is the dictionary and the element's key is the key. You can think of the Window as being a dictionary of elements and the keys are how they are found. This is how I would explain it to an audience.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.