Python(パイソン) ,ソースプログラムリスト あり ,[指定された曲線を、指定された値で、近似的に等分割し、その結果を画面上に表示する] 処理の , [データ入力用・サブグループ]

Python(パイソン) ,ソースプログラムリスト あり ,プログラム作ってみた ,[指定された曲線を、指定された値で、近似的に等分割し、その結果を画面上に表示する] を 行う へ
-----

2024.8.17 presented in [note] ( //note.com/runningWater/ )
2024.8.24 rewritten

----------
1 はじめに

これ以降に記述されている内容は、このようなコンピューター・プログラムを制作した、というような事を、ただ、述べているに過ぎない。

以下の記述を読んだ人が、それを単に参考にする、というのであれば、問題は無いと、思われる。

しかし、記述されている内容に沿って、その人が、そこに記されているのと同様の制作や作業を行った際に、その制作、作業、コンピューターの作動の結果、使用されたコンピューター等、様々な方面において、何らかの問題が発生しない、という保証は、全くない。

その制作、作業、コンピューターの作動の結果、その人や、その人が所属している組織、その人が使用した様々な機器、インフラストラクチャー等の、身の上にどのような事が起ころうとも、私は一切、責任を負わない。

このプログラムは、Python(パイソン) 言語を使って、記述されている。

----------
2 データ入力用・サブグループ

このサブグループは、データの入力を受付けたり、ボタンのクリック(様々の処理の要求)を受け付けたり、といったような機能を果たす。

下記の1個のモジュールから、構成されている。

ファイル名 [DataInputForm.py]

-----

import tkinter as TKINTER
from   tkinter import messagebox
import Mediator

MODULE_NAME = "DataInputForm"

global_root_of_Form = " "
global_text_box_1 = " "

  #-----------------------------------------
def button_display_image ( ) :

    function_name = "button_display_image"

    string_get = global_text_box_1.get()

    # messagebox.showinfo ( "text_box_1 value", string_get )

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "    string_get = " + string_get )
    print ( "==================================" )

    Mediator.display_image ( string_get )

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

  #-----------------------------------------
def button_write_image_to_OuterMedia ( ) :

    function_name = "button_write_image_to_OuterMedia"

    # messagebox.showinfo ( "write_image" )

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    Mediator.write_image_to_OuterMedia ( )

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

  #-----------------------------------------
def button_terminate_all_process ( ) :

    function_name = "button_terminate_all_process"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    Mediator.terminate_all_process ( )

#----------------------------------
        # display form for intput
def display_form_for_intput ( ) :

    function_name = "display_form_for_intput"

    print ( "==================================" )
    print ( "Enter into , Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

         # make window
             #---------------------
    window_width = 300
    window_height = 343
    window_TopLeft_x = 1
    window_TopLeft_y = 1
    window_left_margin_x = 15
    window_top_margin_y = 15
    window_height_of_one_item = 20
    window_interval_of_rows = 30
    window_height_of_item_plus_interval \
       = window_height_of_one_item + window_interval_of_rows
             #---------------------
    geometry_string = \
          str ( window_width )      \
        + "x"                       \
        + str ( window_height )     \
        + "+"                       \
        + str ( window_TopLeft_x )  \
        + "+"                       \
        + str ( window_TopLeft_y )
    print ( "geometry_string = " + geometry_string )

    global  global_root_of_Form
    global_root_of_Form = TKINTER.Tk ( )
         # set size of window
    global_root_of_Form.geometry ( geometry_string )
    #  root_of_Form.geometry ( "500x700" )

         # set font size, font type = default
    font_of_String = ( "", 15 )

    print ( "==================================" )
    print ( "Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "********* passed phase 1 ***********" )
    print ( "==================================" )

          # make test box amd set into form
    label_1 = TKINTER.Label( global_root_of_Form, font = font_of_String \
                                , text = "Number Of Parts" )
    label_1.place ( x = window_left_margin_x   \
                  , y = ( window_top_margin_y +    \
                          ( window_height_of_item_plus_interval * ( 0 ) )   \
                        )
                  , width = 150 , height = 30    \
                   )

    global  global_text_box_1
    global_text_box_1 = TKINTER.Entry ( global_root_of_Form, font = font_of_String )
    global_text_box_1.place (   \
                    x = ( window_left_margin_x + 180 )   \
                  , y = ( window_top_margin_y +    \
                          ( window_height_of_item_plus_interval * ( 0 ) )   \
                        )
                  , width = 60, height = 30    \
                   )

          # made button and set into form
    btn_display_image  \
           = TKINTER.Button (
                      global_root_of_Form
                    , text = "Display Image"
                    , font = font_of_String
                    , command = button_display_image
                              )
    btn_display_image.place (   \
                    x = ( window_left_margin_x + 0 )   \
                  , y = ( window_top_margin_y +    \
                          ( window_height_of_item_plus_interval * ( 1 ) )   \
                        )
                  , width = 240, height = 40    \
                   )
        #------------------------------
    btn_write_image_to_OuterMedia \
           = TKINTER.Button (
                      global_root_of_Form
                    , text = "Write Image to OuterMedia"
                    , font = font_of_String
                    , command = button_write_image_to_OuterMedia
                              )
    btn_write_image_to_OuterMedia.place (   \
                    x = ( window_left_margin_x + 0 )   \
                  , y = ( window_top_margin_y +    \
                          ( window_height_of_item_plus_interval * ( 2 ) )   \
                        )
                  , width = 240, height = 40    \
                   )
        #------------------------------
    btn_terminate_all_process \
           = TKINTER.Button (
                      global_root_of_Form
                    , text = "Terminate All Process"
                    , font = font_of_String
                    , command = button_terminate_all_process
                              )
    btn_terminate_all_process.place (   \
                    x = ( window_left_margin_x + 0 )   \
                  , y = ( window_top_margin_y +    \
                          ( window_height_of_item_plus_interval * ( 3 ) )   \
                        )
                  , width = 240, height = 40    \
                   )

    print ( "==================================" )
    print ( "Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "********* passed phase 2 ***********" )
    print ( "==================================" )

              # main loop
    global_root_of_Form.mainloop ( )

#------------------------------------
def func_destroy_window ( ) :

    function_name = "func_destroy_window"

    print ( "==================================" )
    print ( "Enter into Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

    global  global_root_of_Form
    global_root_of_Form.destroy ( )

    print ( "==================================" )
    print ( "Exit from Module = " + MODULE_NAME
                      + " , function = " + function_name )
    print ( "==================================" )

-----
Python(パイソン) ,ソースプログラムリスト あり ,プログラム作ってみた ,[指定された曲線を、指定された値で、近似的に等分割し、その結果を画面上に表示する] を 行う へ

この記事が気に入ったらサポートをしてみませんか?