質問編集履歴
2
エラー行
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -6,6 +6,9 @@ 
     | 
|
| 
       6 
6 
     | 
    
         
             
            ご教示のほどよろしくお願いいたします。
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            ### 発生している問題・エラーメッセージ
         
     | 
| 
      
 9 
     | 
    
         
            +
            line 28, in calculate_white_ratio
         
     | 
| 
      
 10 
     | 
    
         
            +
                class2=Win2()
         
     | 
| 
      
 11 
     | 
    
         
            +
                       ^^^^^^
         
     | 
| 
       9 
12 
     | 
    
         
             
            TypeError: Win2.__init__() missing 1 required positional argument: 'master'
         
     | 
| 
       10 
13 
     | 
    
         | 
| 
       11 
14 
     | 
    
         
             
            ```Python
         
     | 
| 
         @@ -36,7 +39,9 @@ 
     | 
|
| 
       36 
39 
     | 
    
         
             
                    img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
         
     | 
| 
       37 
40 
     | 
    
         | 
| 
       38 
41 
     | 
    
         
             
                    # 二値化のしきい値
         
     | 
| 
      
 42 
     | 
    
         
            +
                    class2=Win2()
         
     | 
| 
      
 43 
     | 
    
         
            +
                    result = class2.on_submit()
         
     | 
| 
       39 
     | 
    
         
            -
                    threshold =  
     | 
| 
      
 44 
     | 
    
         
            +
                    threshold = result
         
     | 
| 
       40 
45 
     | 
    
         | 
| 
       41 
46 
     | 
    
         
             
                    # 二値化
         
     | 
| 
       42 
47 
     | 
    
         
             
                    _, binary_img = cv2.threshold(img, threshold, 255, cv2.THRESH_BINARY)
         
     | 
1
見やすく修正しました
    
        title	
    CHANGED
    
    | 
         
            File without changes
         
     | 
    
        body	
    CHANGED
    
    | 
         @@ -7,7 +7,8 @@ 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            ### 発生している問題・エラーメッセージ
         
     | 
| 
       9 
9 
     | 
    
         
             
            TypeError: Win2.__init__() missing 1 required positional argument: 'master'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```Python
         
     | 
| 
       11 
12 
     | 
    
         
             
            import tkinter as tk
         
     | 
| 
       12 
13 
     | 
    
         
             
            from tkinter import ttk
         
     | 
| 
       13 
14 
     | 
    
         
             
            import os.path
         
     | 
| 
         @@ -118,3 +119,4 @@ 
     | 
|
| 
       118 
119 
     | 
    
         | 
| 
       119 
120 
     | 
    
         
             
            if __name__ == "__main__":
         
     | 
| 
       120 
121 
     | 
    
         
             
                main()
         
     | 
| 
      
 122 
     | 
    
         
            +
            ```
         
     |