Python issue with implicit data types
|
08-02-2024, 04:13 PM
(This post was last modified: 08-02-2024 04:15 PM by Albert Chan.)
Post: #5
|
|||
|
|||
RE: Python issue with implicit data types
Hi, 34C
col = (R*256 + G)*256 + B Formula is to pack color fields into 1 number, with R,G,B as integers, 0 to 255 If variables have fractional parts, it will mess up the combined packed color value. Your fix is really the correct formula, may not be Python type issue at all. col = (int(R)*256 + int(G))*256 + int(B) To confirm, add 1 more statement, and see if colors changed col = float(col) |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Python issue with implicit data types - 34C - 08-01-2024, 11:08 AM
RE: Python issue with implicit data types - nbc12 - 08-01-2024, 08:13 PM
RE: Python issue with implicit data types - bxparks - 08-01-2024, 09:33 PM
RE: Python issue with implicit data types - toml_12953 - 08-01-2024, 09:23 PM
RE: Python issue with implicit data types - Albert Chan - 08-02-2024 04:13 PM
RE: Python issue with implicit data types - 34C - 08-03-2024, 09:25 AM
|
User(s) browsing this thread: 5 Guest(s)