03. Basic Widget - 2

TOC A. Combo Box B. Check Button C. Radio Button D. Scrolled Text A. Combo Box Combo box is a widget which lets a user ch...

TOC

tkinter

A. Combo Box

Combo box is a widget which lets a user choose among the given itmes.

comboBox
Image 1

  • Line 4: defines the action for button click.
  • Line 5: changes the text of the label.
  • Line 13: defines the label for number. When the combo box is set and Enter button is clicked, this label will be updated as the value of the combo box.
  • Line 16: defines string variable. It will be connected to the combo box, and updated by the combo box.
  • Line 17: defines the initial values for the combo box. Unfortunately, combo box is only available for TTK.
  • Line 18: sets the current value for the combo box. The value is set by index. In this code, "0" means the the first item.

The values of the combo box can be changed, when an item is active and a user types something.

This can be prevented by state property. If state is readonly, a user cannot modify the values.

changeValue
Image 2

  • Line 17: sets state as readonly.

B. Check Button

Check button is a widget to set a boolean value. If check button is selected, the return value is 1. If not, the return value is 0. If state property is disabled, the check button is not activated.

checkButton
Image 3

  • Line 23, 28, 33: define Integer variables. They are connected to each check button, and they will be updated by each check button.

C. Radio Button

Radio button gives a user an opportunity to select an item. The user can select only one of them.

  • Blue:

blue
Image 4

  • Yellow:

Yellow
Image 5

  • Red:

red
Image 6

  • Line 4, 5, 6: defines color variables. Tktinter can use color name instead of RGB hex values.
  • Line 8: defines an action after one of radio buttons is clicked. Regarding the radio button clicked, the color of the background is changed.
  • Line 17: defines Integer variable. It connected to radio buttons, and it will updated in RadAction method.
  • Line 18, 21, 24: defines radio buttons. radVar is updated as the value of value, when radio button is clicked.

D. Scrolled Text

Scrolled text is similar to text box, but it is much larger. It supports multiple lines, so it is used for notepad and so on.

scrolledText
Image 7

  • Line 5: sets a variable for the height of the scrolled text.
  • Line 10, 11, 12: create labels. They are used to show the feature of columnspan.
  • Line 14: creates scrolled text. Wrap can have tk.WORD and tk.CHAR. When text was reached at the border of scrolled text, the text should be moved to the next line. If tk.WORD is given, the text is spliited by words. If tk.CHAR is given, the text is splitted by characters.
  • Line 15: sets a position. Columnspan is used to span multiple columns. By using this, scrolled text takes 3 columns.

COMMENTS

Name

0 weights,1,abstract class,1,active function,3,adam,2,Adapter,1,affine,2,argmax,1,back propagation,3,binary classification,3,blog,2,Bucket list,1,C++,11,Casting,1,cee,1,checkButton,1,cnn,3,col2im,1,columnspan,1,comboBox,1,concrete class,1,convolution,2,cost function,6,data preprocessing,2,data set,1,deep learning,31,Design Pattern,12,DIP,1,django,1,dnn,2,Don't Repeat Your code,1,drop out,2,ensemble,2,epoch,2,favicon,1,fcn,1,frame,1,gradient descent,5,gru,1,he,1,identify function,1,im2col,1,initialization,1,Lab,9,learning rate,2,LifeLog,1,linear regression,6,logistic function,1,logistic regression,3,logit,3,LSP,1,lstm,1,machine learning,31,matplotlib,1,menu,1,message box,1,mnist,3,mse,1,multinomial classification,3,mutli layer neural network,1,Non Virtual Interface,1,normalization,2,Note,21,numpy,4,one-hot encoding,3,OOP Principles,2,Open Close Principle,1,optimization,1,overfitting,1,padding,2,partial derivative,2,pooling,2,Prototype,1,pure virtual function,1,queue runner,1,radioButton,1,RBM,1,regularization,1,relu,2,reshape,1,restricted boltzmann machine,1,rnn,2,scrolledText,1,sigmoid,2,sigmoid function,1,single layer neural network,1,softmax,6,softmax classification,3,softmax cross entropy with logits,1,softmax function,2,softmax regression,3,softmax-with-loss,2,spinBox,1,SRP,1,standardization,1,sticky,1,stride,1,tab,1,Template Method,1,TensorFlow,31,testing data,1,this,2,tkinter,5,tooltip,1,Toplevel,1,training data,1,vanishing gradient,1,Virtual Copy Constructor,1,Virtual Destructor,1,Virtual Function,1,weight decay,1,xavier,2,xor,3,
ltr
item
Universe In Computer: 03. Basic Widget - 2
03. Basic Widget - 2
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirdMmhVpxRFieeUmZXGBKU_npD1ST1xcCJiO6Dy1aPAaCH3EhK3o4MAkEtdHRLWndceVT_yoBi3TR_vevXBS_FXRoCeqx1FDc9qqgJ3Y5vPCRly1GyLhzxaOV-hF79k6H1NfHJKZyWJydv/s0/
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirdMmhVpxRFieeUmZXGBKU_npD1ST1xcCJiO6Dy1aPAaCH3EhK3o4MAkEtdHRLWndceVT_yoBi3TR_vevXBS_FXRoCeqx1FDc9qqgJ3Y5vPCRly1GyLhzxaOV-hF79k6H1NfHJKZyWJydv/s72-c/
Universe In Computer
https://kunicom.blogspot.com/2017/06/03-basic-widget.html
https://kunicom.blogspot.com/
https://kunicom.blogspot.com/
https://kunicom.blogspot.com/2017/06/03-basic-widget.html
true
2543631451419919204
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy