[断面画像を重ね合わせて、物体を3次元表示]の , [データ入力用・サブグループ]
[断面画像を重ね合わせて、物体を3次元表示], Python(パイソン) 使って作ってみた ,ソースプログラムリスト あり へ
-----
2024.8.23 presented in [note] ( //note.com/runningWater/ )
2024.8.24 rewritten
----------
1 はじめに
これ以降に記述されている内容は、このようなコンピューター・プログラムを制作した、というような事を、ただ、述べているに過ぎない。
以下の記述を読んだ人が、それを単に参考にする、というのであれば、問題は無いと、思われる。
しかし、記述されている内容に沿って、その人が、そこに記されているのと同様の制作や作業を行った際に、その制作、作業、コンピューターの作動の結果、使用されたコンピューター等、様々な方面において、何らかの問題が発生しない、という保証は、全くない。
その制作、作業、コンピューターの作動の結果、その人や、その人が所属している組織、その人が使用した様々な機器、インフラストラクチャー等の、身の上にどのような事が起ころうとも、私は一切、責任を負わない。
このプログラムは、Python(パイソン) 言語を使って、記述されている。
----------
2 データ入力用・サブグループ
このサブグループは、データの入力を受付けたり、ボタンのクリック(様々の処理の要求)を受け付けたり、といったような機能を果たす。
下記の1個のモジュールから、構成されている。
ファイル名 [DataInputFormV2.py]
-----
import tkinter as TKINTER
from tkinter import messagebox
import Mediator
import DataToBeHandedOver
MODULE_NAME = "DataInputFormV2"
# **********************
global_number_of_value_inputed = 2
global_list_value_inputed = [ " " ] * global_number_of_value_inputed
global_list_guide_string_of_items = [ \
"degree_XAxis_to_YAxis" \
, "degree_XAxis_to_ZAxis" \
]
global_list_label = " "
global_ins_DataToBeHandedOver = " "
# -----------------------------------------
def initializing_process ( ) :
function_name = "initializing_process"
print ( "==================================" )
print ( "Enter into , Module = " + MODULE_NAME
+ " , function = " + function_name )
print ( "==================================" )
global global_ins_DataToBeHandedOver
global_ins_DataToBeHandedOver = \
DataToBeHandedOver.DataToBeHandedOver ( \
global_number_of_value_inputed \
, global_list_guide_string_of_items )
#----------------------------------
# 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 ( "==================================" )
global global_ins_DataToBeHandedOver
global global_list_value_inputed
global global_list_text_box
global global_list_label
# make window
#---------------------
window_width = 345
window_height = 400
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 )
# set font size, font type = default
font_of_String = ( "", 15 )
print ( "==================================" )
print ( "Module = " + MODULE_NAME
+ " , function = " + function_name )
print ( "********* passed phase 1 ***********" )
print ( "==================================" )
# -----------------------------
# make text box amd set into form
global_list_label = [ ]
global_list_text_box = [ ]
width_of_label = 200
height_of_label = 30
width_of_TextBox = 50
# make label and textbox
for i in range ( global_number_of_value_inputed ) :
w_label = \
TKINTER.Label( global_root_of_Form, font = font_of_String \
, text = \
global_list_guide_string_of_items [ i ] \
)
w_label \
.place ( x = window_left_margin_x \
, y = ( window_top_margin_y + \
( window_height_of_item_plus_interval * \
( i )
) \
)
, width = width_of_label , height = height_of_label ) \
global_list_label \
.append ( w_label )
# ---------------------
text_box = \
TKINTER.Entry ( global_root_of_Form, font = font_of_String )
text_box \
.place ( \
x = ( window_left_margin_x + width_of_label + 10 ) \
, y = ( window_top_margin_y + \
( window_height_of_item_plus_interval * \
( ( i ) ) \
) \
)
, width = width_of_TextBox, height = height_of_label \
)
global_list_text_box \
.append ( text_box )
# --------------------------------------
# made button and set into form
begining_y_of_Button_Area = \
window_top_margin_y + \
( window_height_of_item_plus_interval * \
global_number_of_value_inputed ) \
+ 20
width_of_Button = 240
height_of_Button = 40
# ------- btn_set_angle -----------------
btn_set_angle \
= TKINTER.Button (
global_root_of_Form
, text = "Set Angle"
, font = font_of_String
, command = button_set_rotation_angle
)
btn_set_angle.place ( \
x = ( window_left_margin_x + 0 ) \
, y = ( begining_y_of_Button_Area + \
( window_height_of_item_plus_interval * ( 0 ) ) \
)
, width = width_of_Button, height = height_of_Button \
)
#-------- btn_display_image ----------------------
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 = ( begining_y_of_Button_Area + \
( window_height_of_item_plus_interval * ( 1 ) ) \
)
, width = width_of_Button, height = height_of_Button \
)
#--------- btn_write_image_to_OuterMedia ---------------------
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 = ( begining_y_of_Button_Area + \
( window_height_of_item_plus_interval * ( 2 ) ) \
)
, width = width_of_Button , height = height_of_Button \
)
#------- btn_terminate_all_process -----------------------
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 = ( begining_y_of_Button_Area + \
( window_height_of_item_plus_interval * ( 3 ) ) \
)
, width = width_of_Button , height = height_of_Button \
)
print ( "==================================" )
print ( "Module = " + MODULE_NAME
+ " , function = " + function_name )
print ( "********* passed phase 2 ***********" )
print ( "==================================" )
# main loop
global_root_of_Form.mainloop ( )
#-----------------------------------------
def button_set_rotation_angle ( ) :
function_name = "button_set_rotation_angle"
print ( "==================================" )
print ( "Enter into Module = " + MODULE_NAME
+ " , function = " + function_name )
print ( "==================================" )
global global_ins_DataToBeHandedOver
global global_list_text_box
string_get_1 = global_list_text_box [ 0 ].get()
string_get_2 = global_list_text_box [ 1 ].get()
global_ins_DataToBeHandedOver \
.set_value ( 1 \
, string_get_1 \
)
global_ins_DataToBeHandedOver \
.set_value ( 2 \
, string_get_2
)
# messagebox.showinfo ( "text_box_1 value", string_get_1 )
Mediator.set_rotation_angle ( global_ins_DataToBeHandedOver )
print ( "==================================" )
print ( "Exit from Module = " + MODULE_NAME
+ " , function = " + function_name )
print ( "==================================" )
#-----------------------------------------
def button_display_image ( ) :
function_name = "button_display_image"
string_get = "Wait a while until the process is complete, ok?"
messagebox.showinfo ( \
"message", 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 ( )
#------------------------------------
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 ( "==================================" )
-----
[断面画像を重ね合わせて、物体を3次元表示], Python(パイソン) 使って作ってみた ,ソースプログラムリスト あり へ