Code attached.
Here is the key changes:
TextInput:
id: ti
hint_text: 'Enter Text'
size_hint: .2,.08
pos_hint: {'x': .4, 'y':.3}
opacity: 0 # In Visible
disabled: not all([chk_mamidi.active, chk_ramesh.active, chk_raja.active])
on_disabled: self.opacity = 0 if self.disabled else 1
--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/ec9085c5-b07e-4fab-a5d7-4f8fddc0d298n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/605e041d.1c69fb81.c42c9.efb2SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Be very specific. What do you want to achieve?
My interpretation:
If any 2 checkboxes are checked, and one is unchecked, the textbox is visible.
You would need to list out the cases.
all([not chk_1.active, chk_2.active, chk_3.active]) or all([chk_1.active, not chk_2.active, chk_3.active]) or all([chk_1.active, chk_2.active, not chk_3.active])
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-VhjuVTLWX7kh07xmTYNHPTyjoBoCfggDWDDeFqau_Jxew%40mail.gmail.com.
disabled: all([not chk_ramesh.active, not chk_raja.active])To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/605e1e2f.1c69fb81.a0563.1c98SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Key changes:
disabled: not any([chk_ramesh.active, chk_raja.active])
Added the date.
class CheckTest(BoxLayout):
def on_kv_post(self, base_widget):
self.ids.ti.text = date.today().strftime('%x')
I also changed the name checkText to CheckTest to conform to Python conventions for class names.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-VgJhaMRqqcyZvqTjV3JC7VxtT8NLWCae4ypNNDqz3bKLA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/6061ddb4.1c69fb81.1853e.a097SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Here is how you access the desired attributes:
def new_user_setup_continue(self, dt):
# pass
# using list
app = App.get_running_app()
print(app.root.ids.sm.get_screen('First').ids)
p = app.root.ids.sm.get_screen('First').ids
print(p.sv_box.children)
for c in p.sv_box.children[::-1]:
print(f'NamedInput: {c.ids.ti.text}')
print(f'{p.chk_rda.active=}')
code attached.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-Vj5vgpm6mxpNsw2jj6g0s2r713GqskRgewqvmGnqeDVNA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60632d7a.1c69fb81.1853e.501eSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Create a color property in NamedInput, and use it to set the color of the text. In the code below I have set them all to the same color. Changes highlighted.
from datetime import date
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import StringProperty, ColorProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
from kivy.uix.screenmanager import Screen, ScreenManager
kv = '''
<Mainscreen>:
name: 'main'
Label:
text: 'Select Task '
font_size: 30
size_hint: .3,.2
pos_hint: {'center_x':.5, 'center_y':.9}
FloatLayout:
Button:
text: 'User_Setup'
size_hint: .2,.1
pos_hint: {'center_x':.4, 'center_y':.5}
on_release:
root.manager.transition.direction= 'left'
root.manager.current = "First"
Button:
text: 'Temp_Setup'
size_hint: .2,.1
pos_hint: {'center_x':.6, 'center_y':.5}
on_release:
root.manager.transition.direction= 'left'
root.manager.current = "Second"
<NamedInput>:
size_hint_y: None
height: 30
Label:
id: label
text: root.name
color: root.color
TextInput:
id: ti
hint_text: 'Enter Text'
write_tab: False
<First>:
name:"First"
BoxLayout:
padding: 10
BoxLayout: # The left side
BoxLayout: # The Center
orientation: 'vertical'
spacing: 40
size_hint_x: None
width: 300
Label: # Space at the top
text: 'Scroll View Test'
size_hint_y: .2
ScrollView:
do_scroll_x: False
do_scroll_y: True
scroll_type:['bars', 'content']
bar_inactive_color: 0,0,0,0.6
bar_width: 12
InputsBoxLayout:
id: sv_box
orientation: 'vertical'
# must set the size of the item is the scroll view - or it will not scroll
size_hint_y: None
height: self.minimum_height
#-----------------------------------------------------------------------
# Adding below code to test checkbox
#Label:
# text: 'Include:'
# size_hint: .1,.2
# pos_hint:{'x':.1, 'y':.01}
FloatLayout:
#padding: 40
orientaion:'vertical'
size_hint_y: None
#height: 48
TextInput:
id: ti
hint_text: 'Enter Text'
size_hint: .4,.3
pos_hint: {'x': .6, 'y':.1}
opacity: 0 # In Visible
disabled: not any([chk_fu.active, chk_fe.active])
on_disabled: self.opacity = 0 if self.disabled else 1
readonly: True
Label:
text: 'Include:'
size_hint: .1,.2
pos_hint:{'x':.06, 'y':.5}
Label:
text: 'RDA'
size_hint: .1,.2
pos_hint: {'x': .3, 'y':.5}
#text_size: self.size
#valign: 'middle'
CheckBox:
#group: 'check'
id : chk_rda
text: "rda"
size_hint: .1,.2
pos_hint: {'x': .2, 'y':.5}
canvas.before:
# applying color for Outer rectangle
Color:
rgb: 1,0,1
Rectangle:
pos:self.center_x-8, self.center_y-8
size:[15,16]
# applying color for Inner rectangle
Color:
rgb: 0,0,0
Rectangle:
pos:self.center_x-7, self.center_y-7
size:[13,13]
Label:
text: 'File Express'
size_hint: .1,.2
pos_hint: {'x': .6, 'y':.5}
#text_size: self.size
#valign: 'middle'
CheckBox:
#group: 'check'
id : chk_fe
text: "fe"
size_hint: .1,.2
pos_hint: {'x': .42, 'y':.5}
#on_active: ti
#active: False
#on_active: ti.opacity=1
#on_active:
# root.on_checkbox_active(*args)
canvas.before:
# applying color for Outer rectangle
Color:
rgb: 1,0,1
Rectangle:
pos:self.center_x-8, self.center_y-8
size:[15,16]
# applying color for Inner rectangle
Color:
rgb: 0,0,0
Rectangle:
pos:self.center_x-7, self.center_y-7
size:[13,13]
Label:
text: 'File Upload'
size_hint: .1,.2
pos_hint: {'x': .97, 'y':.5}
#text_size: self.size
#valign: 'middle'
CheckBox:
#group: 'check'
id : chk_fu
text: "fu"
size_hint: .1,.2
pos_hint: {'x': .8, 'y':.5}
#on_active: ti
#active: False
#on_active: ti.opacity=1
#on_active:
# root.on_checkbox_active(*args)
canvas.before:
# applying color for Outer rectangle
Color:
rgb: 1,0,1
Rectangle:
pos:self.center_x-8, self.center_y-8
size:[15,16]
# applying color for Inner rectangle
Color:
rgb: 0,0,0
Rectangle:
pos:self.center_x-7, self.center_y-7
size:[13,13]
#-----------------------------------------------------------------------
BoxLayout:
size_hint_y: None
height: 48
Button:
text:'Back'
on_press:
root.manager.transition.direction = 'right'
root.manager.current = 'main'
Button:
text: 'Next'
on_release:
sv_box.newUserSetup()
BoxLayout: # space at the bottom
BoxLayout: # The right side
<Second@Screen>: # added @Screeen to get code to build
name:"Second"
FloatLayout:
Label:
text: 'Client Name:-'
size_hint: .2, .1
pos_hint:{'x': .3, 'y': .5}
TextInput:
id: client_name
size_hint: .2, .055
pos_hint:{'x': .47, 'y': .52}
hint_text:'Enter Text'
Label:
text: 'Email:-'
size_hint: .2, .1
pos_hint:{'x': .3, 'y': .4}
TextInput:
id: email
size_hint: .2, .055
pos_hint:{'x': .47, 'y': .42}
hint_text:'Enter Text'
Button:
text: 'Back'
size_hint: .18, .08
pos_hint:{'x': .36, 'y': .30}
on_press:
root.manager.transition.direction = 'right'
root.manager.current = 'main'
Button:
text: 'Next'
size_hint: .18, .08
pos_hint:{'x': .54, 'y': .30}
on_press:
root.openChrome()
<mailWaitPopup>:
#title: 'Please Wait'
title: ''
separator_height: 0
size_hint:(None, None)
size:(300, 100)
#on_open: app.sv_box.newUserSetup()
BoxLayout:
orientation: 'vertical'
Label:
text: 'Please wait...we are building Mail setup!'
<webWaitPopup>:
title: ''
separator_height: 0
size_hint:(None, None)
size:(300, 100)
BoxLayout:
orientation: 'vertical'
Label:
text: 'Please wait...IE browser setting-up!'
<closePopup>:
title: 'Task Completed...!'
size_hint:(None, None)
size:(300, 150)
#on_dismiss: app.sv_box.newUserSetup()
BoxLayout:
orientation: 'vertical'
Label:
text: 'Do you want to Repeat the Task?'
BoxLayout:
size_hint_y: None
height: 38
Button:
text: 'Yes'
#size_hint: .8,.4
on_press:
app.root.ids.sm.get_screen('First')
root.dismiss()
Button:
text: 'No'
#size_hint: .8,.4
on_press: app.stop()
<ErrorPopup>:
title: ''
separator_height: 0
size_hint:(None, None)
size:(300, 100)
auto_dismiss: False
BoxLayout:
orientation: 'vertical'
Label:
text: 'we got error...!'
BoxLayout:
orientation: 'vertical'
ScreenManagment:
id: sm
Mainscreen:
First:
Second:
'''
class mailWaitPopup(Popup):
pass
class webWaitPopup(Popup):
pass
class closePopup(Popup):
pass
class ErrorPopup(Popup):
pass
class Mainscreen(Screen):
pass
class ScreenManagment(ScreenManager):
pass
class NamedInput(BoxLayout):
name = StringProperty()
color = ColorProperty('yellow')
class InputsBoxLayout(BoxLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.long_wait_pop = None
self.close_pop = None
def on_kv_post(self, base_widget):
# self.ids.ti.text = date.today().strftime('%x')
# self.pop = Popp()
self.mail_wait_pop = mailWaitPopup()
self.close_pop = closePopup()
# -------------------------------------------------------
# using column names
a = ['* a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k']
for i in a:
w = NamedInput(name=f'{i}')
self.add_widget(w)
def print_text(self):
for named_input in self.children:
print(f'{named_input.ids.label} - {named_input.ids.ti.text}')
def print_select_text(self):
# using list
inputs_list = [ni.ids.ti.text for ni in self.children]
print(f'list in reverse order {inputs_list}')
inputs_list.reverse()
print(f'list in correct order {inputs_list}')
# to display 2 label value
print(f'input value for label 2 is:- {inputs_list[1]}')
# using dictionary
inputs_dict = {ni.ids.label.text: ni.ids.ti.text for ni in self.children}
# print(inputs_dict['Input Name 2'])
# print(f'Input Name 2: {inputs_dict["Input Name 2"]}')
# print(f'Input Name 2: {inputs_dict["2"]}')
print(f'Input Name 2: {inputs_dict["Company Name"]}')
def newUserSetup(self):
self.mail_wait_pop.open()
Clock.schedule_once(self.new_user_setup_continue)
def new_user_setup_continue(self, dt):
# pass
# using list
app = App.get_running_app()
print(app.root.ids.sm.get_screen('First').ids)
p = app.root.ids.sm.get_screen('First').ids
print(p.sv_box.children)
for c in p.sv_box.children[::-1]:
print(f'NamedInput: {c.ids.ti.text}')
print(f'{p.chk_rda.active=}')
# inputs_list = [ni.ids.ti.text for ni in self.children]
# inputs_list.reverse()
# b = inputs_list[0]
# print(f'value of b is:- {b}')
# using dictionary
# inputs_dict = {ni.ids.label.text: ni.ids.ti.text for ni in self.children}
# a = {inputs_dict["a"]}
# print(f'value of a is:- {a}')
# ------------------------------------------------
# for names in inputs_dict:
# print(names)
# ------------------------------------------------
# import openpyxl as xl
# from openpyxl.styles import Font
# wb = xl.Workbook()
# ws = wb.active
# ws['A1'] = 'First Name'
# ws['B1'] = 'Last Name'
# for row in ws.iter_rows(min_col=1, min_row=1, max_col=ws.max_column, max_row=ws.max_row):
# print(row)
# for val in row:
# val.font = Font(bold=True, name='Tahoma', size=10)
# ws['A2'] = inputs_list[0] # using list
# ws['B2'] = inputs_list[1]
# wb.save('excel_details.xlsx')
# # Eraising TextInputs fields
# for ni in self.children:
# ni.ids.ti.text = ''
#
# # calling popup.dismiss
self.mail_wait_pop.dismiss()
self.close_pop.open()
class First(Screen):
# def on_checkbox_active(self, checkbox, value):
# if value:
# # self.ids.ti.enabled = False # to enable the textinput
# self.ids.ti.disabled = True # to disable the textinput
# self.ids.ti.opacity = 1
# else:
# #self.ids.ti.enabled = False
# self.ids.ti.opacity = 0
def on_kv_post(self, base_widget):
self.ids.ti.text = date.today().strftime('%x')
# pass
class MainApp(App):
def build(self):
return Builder.load_string(kv)
MainApp().run()
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-Vhy%2BxuzQHC7pA1%3DAxB9tM-QB6GBSH1BCc8DFEoM-tadZA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60647e18.1c69fb81.bcad.83beSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Use the canvas to draw a line around the layout.
from kivy.app import App
from kivy.lang import Builder
kv = """
<TwoButtonsBoxed@BoxLayout>:
padding: 15
canvas:
Color:
rgba: 1, .2, .3, 1
Line:
width: 2
rectangle: (*self.pos, *self.size)
Button:
text: 'Left'
Button:
text: 'Right'
BoxLayout:
orientation: 'vertical'
padding: 20
spacing: 30
TwoButtonsBoxed:
TwoButtonsBoxed:
"""
class DrawBoxApp(App):
def build(self):
return Builder.load_string(kv)
DrawBoxApp().run()
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-VhjB5dLPk%3DXj21owf9ko5ZfcdfDT48X79madfdMY4o4iQ%40mail.gmail.com.
CheckBox:
id : chk_fe
text: "fe"
size_hint: .1,.2
pos_hint: {'x': .2, 'y':.5}
active: True # to make the checkbox checked by default
#disable: True
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/4Qp2vjI4IsE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60895694.1c69fb81.1c4df.af25SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Use disabled, not disable.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-Vhbd%3DDDNmNi7aCgSxuCH4m%3DV55di27J6sTqXe_MFZcNyg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60ba24d2.1c69fb81.c9f60.0893SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-Vh6gubWF4vgVCxOJ%3DQ2t%2BzztS-t7VG0RRmQMtJc5iNOTw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/EDE20950-BF13-4678-8005-CE4BA2EDF1B4%40cox.net.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CABDb-Vi7r8VLcaVFTLdjjCwm89U2U6akcjiRJ%3DNykiBhC1tBtg%40mail.gmail.com.