Added the .italic property to the name_box.
It works, but in an unsuitable way.
The text the user enters stays italic,
even though it is not ‘placeholder’ text.
Tried to use name_box.placeholder.italic
just returns a ‘string object has no property’
error.
So it seems like the .italic is applied to
all text objects within the name_box,
so still not working as intended
def __init__(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
self.name_box.italic = True
Thanks again to Aldo Ercolani who offered
the suggestion of editing the CSS stylesheet,
in reply to my post yesterday.
Ultimately, with Anvil you’re building a web app which means fine customizations will happen with CSS. Anvil does a pretty good job of giving you access to the most common customizations through Python, but it’ll never be 100% coverage because the range of CSS customizations is huge.
If you care about customizations that aren’t supported by the Python side of Anvil, then you’ll have to get comfortable with using CSS and/or Javascript to make those happen. It’s just part of the learning curve.
I can say that Anvil releases cool new features a lot. In the few years I’ve been working with Anvil, there have been about a dozen new features that would have been terrific to have when I started, but aren’t worth rewriting the old apps to incorporate. Each version gets easier and easier to use.
Your feature request is a good way to tell the Anvil folks that you want this particular customization to be included in the Python side of Anvil. But if you don’t want to wait on them getting around to implementing it (I have no idea how big their list of todo items is), then CSS is the way to go for now.
Thanks jshaffstall! I am trying to love anvil, but it keeps putting barriers in my way. I would really like to advocate for Anvil, among web developers who have realized that layering tool after tool is a losing game. But, especially for beginners, who should never need to learn CSS to get their web forms to look as they expect. Encouraged by your observation that many features have been added over time, hoping it catches up with the competition soon! Will keep posting feature requests, and try to maintain a positive attitude.
I hate CSS, and can never get it to do what I want. But I’ve been able to copy and paste CSS into Anvil to change the appearance of something pretty easily. So you definitely don’t need to learn CSS. You just need to find someone who has learned CSS who’s solved the same problem you’re having, and copy their solution into your CSS file in Anvil.
We also have some CSS experts in the forum, who volunteer their time for those situations where the solution is Anvil specific and needs more sophisticated CSS.
The italicized placeholder text isn’t one of those situations, thankfully, that should just be a straight copy, paste, and forget.
input.anvil-role-placeholdercolor::placeholder {
color: <your color here>;
}
Now add a role called placeholder into your Roles and select it for a component.
Thanks again, divyeshlakhotia, jshaffstall, and Aldo Ercolani!
I fully understand how to edit CSS, and can follow instructions to add a role. However, Anvil’s 'claim to fame; is building web apps in a web app. These features* should amount to clicking a property checkbox, and selecting a size option from a dropdown. At this point, Anvil is losing ground daily, as I find more issues that should be ‘easy’, but require old fashioned, hand editing of layers upon layers, exactly what the Anvil crew says they have ‘fixed’.
*Enable form box width as a property
When I started with Anvil I spent the first few days trying to create a tree with dynamic loading. I had in mind ajax, HTML, CSS, and I knew what I wanted. It was a waste of time. Anvil is different.
Then I have created a few apps without trying to break the constraints that Anvil “forces” on you. After another week I was more familiar with Anvil and I was able to nest repeating panels inside repeating panels and my dynamic trees were way more flexible than what I could have done with ajax & co. I did find some limitations during the process, reported and got them fixed, like this one.
As I started getting familiar with what you can do and my company started asking for a custom look, I spent some time in one “Standard Theme” app (with a huge help from the forum) so it would match the company expectations. The app does nothing, it has just a few test forms that show how the various components look
Now when I create a new app, I clone it, replace its theme folder with the one from “Standard Theme” and push it. These are a few quick ugly manual steps, I wish there was a way to define an app theme template rather than using the clone/replace folder/push trick, but it does the job. After this it’s only Python and online IDE (or PyCharm when I work on more complex classes that need more love).