473,473 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to generate dictionary from selected checkbutton text as key and status as value

5 New Member
I have generated checkbutton from inputstatus dictionary to set as default values.After tht once it get display on GUI when i select it respected text and status will be added to new dictionary

Expand|Select|Wrap|Line Numbers
  1.  
  2.     '''inputstatus = {
  3.             'maggi': 1, \
  4.             'pizza': 1, \
  5.             'cold drinks': 1, \
  6.             'fries': 1, \
  7.             'chapati': 0, \
  8.             'dip': 0
  9.             }'''
  10.         r=3
  11.         cardtype = list(inputstatus)
  12.         for ins in cardtype[:5]:
  13.             print inputstatus[ins]
  14.             if inputstatus[ins]== 1:
  15.                 chk_card = Checkbutton(self.frm1, text= ins, variable= inputstatus[ins])
  16.                 chk_card.select()
  17.             else:
  18.                 chk_card = Checkbutton(self.frm1, text= ins, variable= inputstatus[ins])
  19.                 chk_card.deselect() 
  20.             chk_card.grid(row=r,column=1)
  21.             r=r+1
  22.  
  23.  
this code only displays checkbutton based on default status after selection of checkbutton i need new dictionary which have
current status of menu like {'pizza':0,'chapati':1,....}
Oct 14 '16 #1
1 1094
dwblas
626 Recognized Expert Contributor
The GUI has nothing to do with updating the dictionary other than using the checkbutton to call a function that updates the dictionary/ Since we do not know how you get the data used to update the dictionary there is little more help that can be given.
Oct 14 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Sarah West | last post by:
Hi, I have the following problem; This is my form, i would like to default the select box to USA, and default the text field to a name such as 'Sarah' and the hidden field to another number...
1
by: ouioui | last post by:
Hi, I try to have a communicatition between 2 windows In the first one i have a HTML styled select like that : <form name='addform' id='addform' action='add_dossier.php' method='post' >...
3
by: gasturbtec | last post by:
i'm using access 2000 and have a form in which users can select reports with check boxes and click a print button to print out the selected reports. what i want to do now is place a text box on the...
0
by: NET Developer | last post by:
I have dropdownList boxes that are bound to a function that populates them with different values for the text and value properties. But when an item is selected from the list, both the text and value...
3
by: Roger | last post by:
I want to fill a combo box with a Text value to show like name, but when it is selected I want to get the say SS# or Emp #. I will be filling this in manually how should I go about this. I...
1
by: Jl_G_0 | last post by:
Hey all. I need to create a ComboBox with some strings on it, but when the user selects it, I want to have codes for each one of the strings, because the app is waiting Return in codes (but not...
1
by: Dinu | last post by:
hi i am having a gridview in aspx page and a usercontrol in master page of that page now what i want is selected row text to be displayed in usercontrol i wrote code as follows: ...
6
by: =?Utf-8?B?VGFydW4=?= | last post by:
Hi, I have to generate a fixed length text file.I have a file formats like fields details as well as its length and position.what actually i have to do that i will get the data from the databas...
4
by: coder86 | last post by:
Hi, I am new to this site . I am looking for some help in updating my database from the value selected by user. Heres my page I have a table with rows of ID and its status. Status is a drop...
2
by: mgdvicky | last post by:
I need to generate unique random number to show into the text box value and also perform insert,delete,update operation using java script. I need your solution which is better way using mysql or...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.