TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #62 · 4 апр.

Когда разрабатываете свой GUI с помощью PyQt для какого-либо софта бывает необходимо позаимствовать цвета из текущего стиля интерфейса. Например, чтобы правильно раскрасить свои виджеты, подогнав их по цвету. Ведь бывает, что ваш GUI используется в разных софтах. Причём некоторые со светлой темой а другие с тёмной. По умолчанию стили наследуются, но если вы задаёте какую-либо раскраску для части виджета через свой styleSheet, то требуется ссылаться на цвета текущего стиля. Как это сделать? Как получить нужный цвет из палитры имеющегося стиля? Это достаточно просто, нужно использовать класс QPalette и его роли. Например, мне нужно достать цвет текста из одного виджета и применить его в другом как цвет фона (не важно зачем именно так, просто захотелось😊). Получаем палитру виджета и сразу достаём нужный цвет, указав его роль. from PySide2.QtGui import QPalette color = main_window.palette().color(QPalette.Text) теперь можем использовать этот цвет в стилях my_widget.setStyleSheet(f'background-color: {color.name()};') Готово, мы динамически переопределили дефолтный стиль используя текущий стиль окна! На самом деле есть запись покороче, в одну строку и без лишних переменных. Не очень-то по правилам CSS, но Qt это понимает. my_widget.setStyleSheet('background-color: palette(Text);') Этот способ не подходит если вам нужно как-то модифицировать цвет перед применением в своих стилях. В этом случае потребуется первый способ. Зато он прекрасно сработает в файле .qss, то есть не придётся в коде прописывать раскраску отдельных элементов через ссылки на палитру, всё красиво сохранится в отдельном файле .qss! QListView#my_widget::item:selected { background: palette(Midlight); } Про имеющиеся роли можно почитать здесь🌍 #qt#tricks

Hashtags

Резултати

Пронајдени 3 слични објави

Пребарај: #vlv

当前筛选 #vlv清除筛选
Pensive|

@PensivePost · Post #5221 · 24.05.2021 г., 12:21

The ring of love#1 How far it is? Where are we leading to? What are we? Why we cry? Why we become happy? These thoughts been running in my mind while I am watching the waves on the sea shore. The pleasant music of the waves diverted me from those unanswered questions. The cool breeze touched my hot skin and I just shivered for a moment and smiled with a pleasant face. Through this long journey human race struggled a lot to be here what we are now is a long way journey that the human race has come to. Everyone are different in their own aspects of life. If a man/women is rough, then he might have faced more in his/her life and that's why he/she looks rough and tough to handle. And in other hand if a man or a women is cool and soft, then it means they had built their life in a completely different manner. Everyone has their own way of sculpting their own life. Every one has to face both types of characters in their life and should learn to face all these people. We can't use any filters and neglect them. Because it is a real life where only unexpected things happens. But we dream many things we expect many things in our life and we have the freedom to do so. No one could tell us not to dream and making it true is not in our hand. This doesn't meant that we should not dream we have to dream to move on in our life, so don't stop dreaming... "There can't....." "Hey Aashiv come here man see what we found" a voice interrupted my conversation with my "inner me". I turned towards her and waved my hands and signalled them that I am coming. I got up from the sand and ran towards them. My team found some oldest ring while excavating inside the sand. The ring looked gorgeous and I ran towards the sea and washed the ring with the water. And I just observed something written on the ring it said "Samuthra kumaari", which means "The Princess of Ocean". Suddenly a fictional character came to my mind which I studied in the novel called "Ponniyin selvan". With the sudden reminder of that character I put that ring in my pocket and ran from that place. I reached my bike and I went to kushi beach which is situated near Rameswaram. I consider that place as my soulful site and whenever I feel low I will go to that sea shore and stay there until I feel good. I went there and sat there for a moment and cried hard. I don't know why I am crying like this. But I cried without any thoughts and after a moment everything in my mind settled and I became clear enough to think deep in to my past. A name suddenly came to my mind and I spelled "Riya". Suddenly a single drop of tear came out of my left eye and it fell on the sand. It's been ten years... I didn't even spell her name. When I saw the name in the ring, the dark side of my mind came out and it took me to the darkest part of my life. With this I fainted in the sand and I heard the sound of my friends saying "Aashiv get up man what happened to you?" When I opened my eyes I was going in the car with my "Riya". And... To be continued... Dm me to know more about Aahsiv #review#share#VLV

Pensive|

@PensivePost · Post #5202 · 13.05.2021 г., 12:05

Lost her in the dark sky I lost her in the dark sky, Thought she is hiding behind the stars, It costs my life to find her, I risked my lifetime to search her, Weeks and years passed by, Can't able to find her. At the beginning, I thought, I lost her in the dark sky, But she is purposefully hiding, She knows where I am but I don't Even after knowing this I searched, I didn't stop even after becoming mad. A past reminded me a conversation Her words, "What will you do if you lost me?" I replied I will become mad Those words haunted me deep. Those true words proves my loyalty But more of the past reminded me, My bag full of mistakes... My fate cursed me more and said you deserve it for what you did to her.... #review #poetry #share #VLV

Pensive|

@PensivePost · Post #5203 · 13.05.2021 г., 12:12

Still haunting... Somewhere in the edge of my destiny, I lost myself in the world of memories.. Somewhere in the zenith of the mountain I disappeared in the mist of snow.. Somewhere in the darkest part of my life, I have been left to suffer alone.... #review #share #poet #VLV