Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Tkinter Checkbox
Hello ultimately this GUI will wrap arcs onto cylinders. Continuous linear+rotary. I have the math done (requires touch improvement). Cannot get check button to position properly. PSN_01 ideally below TBE_DIA. When complete ten positions total. Logic is if PSN_01 checked calculate DRL (drill start) + check button on centre or off centre. RGH (rough with endmill if DRL does not complete. FIN (finish with endmill because continuous linear+rotary output is normal to wrap diameter). Features are perpendicular to rotary. Appreciate any help. Cheers.
from datetime import datetime
import math
import sys
import tkinter as tk

def save():
    sys.stdout = open(nc_get.get()+".txt", 'w')  
    now =
    now_str = now.strftime("%H:%M")
    #now_day = now.strftime("%Y.%m.%d")
    #now_str = now.strftime("%H:%M:%S")
    doy =
    if doy < 100:
        now_doy = str(doy)
        now_doy = str("0"+(now_doy))
        now_doy = str(doy)
    print("(PROVEN "+(now_str)+":"+(now_doy)+")")

gui = tk.Tk()

os_wdh = gui.winfo_screenwidth()
os_hgt = gui.winfo_screenheight()
tk_wdh = 500
tk_hgt = 500
xn_cnt = (os_wdh/2)-(tk_wdh/2)
yn_cnt = (os_hgt/2)-(tk_hgt/2)

gui.geometry('%dx%d+%d+%d' % (tk_wdh, tk_hgt, xn_cnt, yn_cnt))
gui.resizable(width=False, height=False)

nc_get = tk.Entry(gui, width=10)
#nc_get.pack#(fill=tk.NONE), y=25) 

nc_run = tk.Button(gui, text='!', width=5, command=save)
#nc_run.pack(), y=22) 

tbe_dia = tk.Entry(gui, width=5)
#tbe_dia.pack#(fill=tk.NONE), y=30) 

tbe_lbl = tk.Label(gui, text = "TBE_DIA")
#tbe_lbl.pack#(fill=tk.NONE), y=30) 

def psn_01():
    print('psn_01 :', chk_v01.get())

chk_v01 = tk.IntVar()

btn_01 = tk.Checkbutton(gui, text = "PSN_01",
                        variable = chk_v01,
                        command = psn_01)
dia_01 = tk.Entry(gui, width=10), y=55)

lbl_01 = tk.Label(gui, text = "DIA"), y=55)

xpn_01 = tk.Entry(gui, width=10), y=55)

lbl_01 = tk.Label(gui, text = "XPN"), y=55)

apn_01 = tk.Entry(gui, width=10), y=55)

lbl_01 = tk.Label(gui, text = "APN"), y=55)
drl_lbl = tk.Label(gui, text = "DRL"), y=90)

drl_01 = tk.Entry(gui, width=10), y=90)

drl_dia = tk.Label(gui, text = "DIA"), y=90)

Larz60+ wrote Jan-12-2020, 03:15 PM:
Please post all code, output and errors (in it's entirety) between their respective tags. I did it for you this time, Here are instructions on how to do it yourself next time.
logic example:
cb_val= chk_v01.get()
if cb_val == 1:
    #do something
    #do the other thing or skip the else

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to get the value of a checkbox scratchmyhead 4 351 May-14-2020, 02:56 PM
Last Post: scratchmyhead
  Tkinter checkbox value scratchmyhead 5 439 May-09-2020, 11:44 PM
Last Post: menator01
  TreeviewWith CheckBox issac_n 1 2,730 Mar-08-2020, 06:51 AM
Last Post: shamnadinn
  [Tkinter] Unable to create checkbox and select at run time tej7gandhi 5 963 May-05-2019, 04:57 PM
Last Post: tej7gandhi
  [PyQt] PyQt4 handle dynamic checkbox click littleGreenDude 1 2,849 Dec-27-2018, 09:17 PM
Last Post: littleGreenDude
  [Tkinter] Completing Action when CheckBox is Checked Anysja 2 3,063 Aug-02-2018, 04:38 PM
Last Post: Anysja
  Displaying error in QTableview and with Checkbox in Column under macOsX nieselfriem 1 2,870 Mar-19-2017, 10:43 PM
Last Post: nilamo

Forum Jump:

Users browsing this thread: 1 Guest(s)