Comments (14)
Hi, it does have quite a bit of sensitive stuff in it. I have downgraded as mentioned, and am picking and choosing the child "okchanges" how they operate on a case by case basis. I have already had about 10 calls this morning saying various ones don't work, so I'm just changing each usecase of the class hardcoded. Generally the manually pulling event 3 and setting it as the value and returning together seem to be working so far. However, on some the returning has crashed it so i have just commented out the ones the return crashes it. I could do a teams or something like that to share the screen if you want to look, but I couldn't do a paste of the code as it has proprietary methods for the company in it.
from tksheet.
So the issue is also present with tksheet version 6.0.1
? Is there any way you could give me a bit of example code? it's hard to track down the issue without it
from tksheet.
Hi, so its basically for storing numerical data and doing some validation...I have some validation on the parent class... self.sheet.extra_bindings("end_edit_cell", func=self.OkChange) to run okChange. If i remove ok change the value updates. The issue is since we bought a new PC that came with windows 11. Code without the additional line works on windows 10, but as a workaround i have just forced saving back the value to the cell at the end on latest version of python and your programme.
so def OkChange(self, event=None):
Row = event[0]
Col = event[1]
self.sheet.highlight_rows([Row], bg=None)
self.currentVal = str(event[3])
self.zippedData[Row][Col] = self.currentVal #########adding this line seems to fix it by saving the value back to the data if that makes sense. However on windows 10 it worked fine.
self.CheckValidValues(Row, Col)
if self.validValue == False:
self.sheet.highlight_cells(row=Row, column=Col, bg="Red")
elif self.validRow == False:
self.sheet.highlight_rows([Row], bg="Red")
elif self.validRow == True:
self.sheet.highlight_rows([Row], bg="Green")
else:
self.sheet.highlight_cells(row=Row, column=Col, bg="Green")
......
here is the parent class...def createLabelAndInputs(self):
self.sheet.set_sheet_data(self.zippedData)
self.sheet.readonly_columns(columns=[0], readonly=True, redraw=True) # make LN column read only
self.sheet.readonly_rows(rows=[0], readonly=True, redraw=True) # make titles none editable
self.sheet.highlight_columns(columns=[0], bg="blue", fg="white") # make LN column blue and white
self.sheet.highlight_rows(rows=[0], bg="blue", fg="white")
self.sheet.align(align="center", redraw=True)
self.sheet.grid()
self.sheet.height_and_width(self.screenheight, self.screenwidth)
# self.sheet.enable_bindings("all")
self.sheet.enable_bindings(("single_select",
"row_select",
"column_width_resize",
"arrowkeys",
"right_click_popup_menu",
"rc_select",
"rc_insert_row",
"rc_delete_row",
"copy",
"cut",
"paste",
"delete",
"undo",
"edit_cell",
"end_edit_cell"))
self.sheet.extra_bindings("end_edit_cell", func=self.OkChange)
self.DT.mainloop()
from tksheet.
@ywith Thanks for the extra info, I think I have tracked down the issue. I am sorry to report that it is because of a change I made to a newer version of tksheet, I have not checked to see which version sorry but I will if you want me to
Basically since the change by default using extra_bindings
with "end_edit_cell"
or "edit_cell"
means whichever function you bind to it has to return the text you want to update the cell with, if it returns None
then the cell isn't updated
You have two choices to resolve this, you can either:
- Put
return event.text
at the bottom of your functionOkChange
or - Use the argument
edit_cell_validation = False
in your= Sheet(...
initialization or you can do the same withsheet.set_options(edit_cell_validation = False)
, with theset_options()
function you only have to do this once, so you can put it near your sheet initialization code
Let me know if these fix your issue, if it does I am sorry for the inconvenience, I am thinking that I should have made it clearer that the change was made, or I should have not made it the default behavior
from tksheet.
Hi, i added return event.text and it now crashes. what line do i change to make the behaviour how it used to be, as i just typed one result in of 32.5, it showed 3.5 and then the next result shows none and then crashes
from tksheet.
Hm, sorry about that, it should work with the latest version but if you want to keep your current version you could try either
- Use the argument edit_cell_validation = False in your = Sheet(... initialization or you can do the same with sheet.set_options(edit_cell_validation = False), with the set_options() function you only have to do this once, so you can put it near your sheet initialization code
Or try using return event[3]
or whichever index it looks like the cell value is in, use print (event)
to see if you can find it
from tksheet.
this is a child one.... def OkChange(self, event=None):
Row = event[0]
Col = event[1]
self.sheet.highlight_rows([Row], bg=None)
self.currentVal = str(event[3])
self.zippedData[Row][Col] = self.currentVal #tried with this commented out and not commented out
self.ABCCheck(Row, Col)
if self.validValue == False:
self.sheet.highlight_cells(row=Row, column=Col, bg="Red")
elif self.validRow == False:
self.sheet.highlight_rows([Row], bg="Red")
elif self.validRow == True:
self.sheet.highlight_rows([Row], bg="Green")
else:
self.sheet.highlight_cells(row=Row, column=Col, bg="Green")
if Col == 1 or Col == 2:
self.calcDensity(Row)
#return self.currentVal #tried with this commented out and not commented out
#tried event.text #tried with this commented out and not commented out
from tksheet.
this is a child one.... def OkChange(self, event=None): Row = event[0] Col = event[1] self.sheet.highlight_rows([Row], bg=None)
self.currentVal = str(event[3]) self.zippedData[Row][Col] = self.currentVal #tried with this commented out and not commented out self.ABCCheck(Row, Col) if self.validValue == False: self.sheet.highlight_cells(row=Row, column=Col, bg="Red") elif self.validRow == False: self.sheet.highlight_rows([Row], bg="Red") elif self.validRow == True: self.sheet.highlight_rows([Row], bg="Green") else: self.sheet.highlight_cells(row=Row, column=Col, bg="Green") if Col == 1 or Col == 2: self.calcDensity(Row) #return self.currentVal #tried with this commented out and not commented out #tried event.text #tried with this commented out and not commented out
Ah, if you have already tried it then I'm not sure what's going on, do you happen to know what the error is?
from tksheet.
i have downgraded and then kept that code of self.zippedData[Row][Col] = self.currentVal and it seems to work.
from tksheet.
Hm... if you want, I could maybe debug it myself if your complete program source code isn't sensitive, you can attach files to messages here I think
from tksheet.
I'm really sorry about the trouble you're having,
I think possibly the safest thing might be to not use return
at all and just use set_cell_data(row, column, value)
to manually set the value, this would be inside okchanges
With version 5.4.1
:
- If you don't want the value to be converted to a string use
set_cell_data(row, column, value, set_copy = False)
- You could alternatively use
self.sheet.MT.data_ref[row][column] = value
for an even more direct approach
from tksheet.
@ywith Ok sorry, I made some edits to my last comment specifically if you're using 5.4.1
which might help
I'm really sorry about the trouble you're having,
I think possibly the safest thing might be to not use return at all and just use set_cell_data(row, column, value) to manually set the value, this would be inside okchanges
With version 5.4.1:
If you don't want the value to be converted to a string use set_cell_data(row, column, value, set_copy = False)
You could alternatively use self.sheet.MT.data_ref[row][column] = value for an even more direct approach
from tksheet.
For forwards compatibility you could use this instead:
try:
self.sheet.MT.data_ref[row][column] = self.currentVal
except:
self.sheet.MT.data[row][column] = self.currentVal
from tksheet.
Hi thanks. The staff should start using the program again after lunch today. I will let you know if there are further issues.
from tksheet.
Related Issues (20)
- Substract values of column 2 with values from column 1 HOT 6
- Custom theme HOT 1
- Feature request: automatically set sheet size to content size
- How to scroll two sheets at the same time HOT 2
- How to change appereance of the Thsheet when bindings are disabled HOT 2
- In drop down, how do i display default text? HOT 1
- Is it possible to center the text in vertical alignment? HOT 1
- Include freezing option HOT 1
- Calculos con tksheet
- trouble with shifting the data over the tksheet HOT 1
- Higher resolution support HOT 9
- Add prompt for wrong keyward args in get_sheet_data/get_cell_data/get_row_data/get_column_data HOT 1
- Issue with set_sheet_data HOT 6
- Manually set displayed row index HOT 3
- Dropdown menu fails to open if some rows are hidden HOT 2
- Update cells data using specific conditions on user input. HOT 27
- SyntaxWarning HOT 3
- Currently selected cell rows in sheet vs in data HOT 2
- on Rpi5, OS debian bookworm, tksheet's sheet defined col-w & row-h of 10x16 cells size has slow/lagging mouse's cursor movement HOT 12
- How to fix the maximum size of characters in tksheet ceels HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tksheet.