Python Forum
[Tkinter] Manipulating Checkboxes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Manipulating Checkboxes
#1
Hi, I have this Checkboxes, İmage

any combination can be selected, and each checkbox selected results in a different query. Instead of using if else, can someone suggest an alternative method, because the combination is gonna be endless
[python]
from tkinter import *
import arcpy
from tkinter import ttk

def select_landuse():
    arcpy.env.workspace = C:/Users/umroot/Documents/ArcGIS/Projects/RecentINSE6421project/affectationpu"
    in_features = "AffectationPU.shp"
    out_feature_class = "C:/Users/umroot/Documents/ArcGIS/Projects/RecentINSE6421project/pythonOutput/affectationpu"
    if (landuse1.get() and landuse3.get() and landuse4.get() and landuse5.get()and landuse6.get()and landuse7.get() and landuse10.get())==TRUE :
        where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'residentiel\')"

    elif(landuse1.get() and landuse3.get()and landuse4.get() and landuse5.get() and landuse6.get() and landuse7.get() and landuse8.get() and landuse9.get() and landuse10.get())==TRUE:
     where_clause="\"categorie\" IN (\'activites diversifiees\',\'conservation\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'residentiel\')"

    elif (landuse1.get()and landuse2.get() and landuse4.get()and landuse4.get()and landuse6.get()and landuse7.get()and landuse9.get() and landuse10.get())==TRUE:
        where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\',\'religieux\',\'residentiel\')"

    elif (landuse1.get()and landuse2.get() and landuse3.get()and landuse4.get()and landuse4.get()and landuse6.get()and landuse7.get()and landuse9.get() and landuse10.get())==TRUE:
        where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\',\'agricole\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'religieux\',\'residentiel\')"


    elif (landuse1.get()and landuse2.get() and landuse3.get()and landuse4.get()and landuse4.get()and landuse6.get()and landuse7.get()and landuse8.get() and landuse10.get())==TRUE:
        where_clause= "\"categorie\" IN (\'activites diversifiees\',\'conservation\',\'agricole\', \'emplois\', \'infrastructure\', \'institution\', \'mixte\', \'parc\',\'residentiel\')"
[/python]
Reply


Messages In This Thread
Manipulating Checkboxes - by teflon - Jun-07-2019, 06:36 PM
RE: Manipulating Checkboxes - by Yoriz - Jun-07-2019, 07:25 PM
RE: Manipulating Checkboxes - by teflon - Jun-07-2019, 09:10 PM
RE: Manipulating Checkboxes - by Yoriz - Jun-07-2019, 09:36 PM
RE: Manipulating Checkboxes - by teflon - Jun-10-2019, 08:44 PM
RE: Manipulating Checkboxes - by teflon - Jun-10-2019, 11:46 PM
RE: Manipulating Checkboxes - by Yoriz - Jun-11-2019, 05:20 AM
RE: Manipulating Checkboxes - by teflon - Jun-11-2019, 03:16 PM
RE: Manipulating Checkboxes - by teflon - Oct-02-2019, 11:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Manipulating an image in python z4rn4v 2 2,168 Jan-02-2019, 12:30 PM
Last Post: z4rn4v
  [Tkinter] Checkboxes in different frames misbehave octoeder 3 4,502 Oct-03-2018, 09:12 AM
Last Post: jfong
  [Tkinter] Print if all checkboxes marked Kaelmi 10 18,693 May-24-2017, 02:17 PM
Last Post: buran
  [WxPython] Setting interdependencies between checkboxes merlem 2 3,684 Feb-12-2017, 07:51 PM
Last Post: merlem

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020