Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Porting tests from R to Python (almost there)
Post: Porting tests from R to Python (almost there)

I'm porting some R scripts to Python. More specifically, Levene, Shapiro-Wilk, ANOVA, Kruskal-Wallis, Tukey HSD and Wilcoxon Rank Sum Test. Most is done with scipy module, so it's all good. However, ...
Alfalfa Data Science 1 1,120 Mar-13-2023, 06:35 PM
    Thread: win32com: How to pass a reference object into a COM server class
Post: RE: win32com: How to pass a reference object into ...

From the documentation, it really seems that DispatchWithEvents() is the way to go in order to relays the events to a regular Python class. However, as shown in the error above it fails on this line (...
Alfalfa General Coding Help 3 4,802 Jul-26-2021, 06:25 PM
    Thread: win32com: How to pass a reference object into a COM server class
Post: RE: win32com: How to pass a reference object into ...

"Parent" declared in _public_attrs_ Error:Traceback (most recent call last): File "Z:\.antidote_\AntidoteCOM.py", line 53, in _connect self.server.parent = self # This File "C:\Users\user\App...
Alfalfa General Coding Help 3 4,802 Jul-25-2021, 11:01 PM
  Exclamation Thread: win32com: How to pass a reference object into a COM server class
Post: win32com: How to pass a reference object into a CO...

I'm trying to implement a cross-platform python interface for a third-party API (Antidote), so that it can communicate with a PyQt application. Firstly, for Linux here's the working D-Bus interface; ...
Alfalfa General Coding Help 3 4,802 Jul-25-2021, 08:11 PM
    Thread: Help for COM server implementation ("Unspecified error" on Dispatch())
Post: RE: Help for COM server implementation ("Unspecifi...

Thanks, looking back it seems obvious but I missed it for some reason. Now I have to find a way to pass the parent argument, as the COM object refuse the pointer.
Alfalfa General Coding Help 2 3,385 Jul-25-2021, 01:36 AM
  Shocked Thread: Help for COM server implementation ("Unspecified error" on Dispatch())
Post: Help for COM server implementation ("Unspecified e...

I'm trying to implement a COM server that will expose some methods, in order to link a third-party API with a PyQt application. The application is a grammar tool called Antidote. The server was regist...
Alfalfa General Coding Help 2 3,385 Jul-23-2021, 11:52 PM
    Thread: Need help with class composition / multiple inheritance / polymorphism (?)
Post: RE: Subclasses and multiple dynamic inheritance / ...

Found this so far; #!/usr/bin/python3 from PyQt5 import QtWidgets class Container(QtWidgets.QWidget): def __init__(self): super().__init__() self.plainText = PlainText() ...
Alfalfa GUI 4 3,014 May-09-2021, 01:01 AM
    Thread: Need help with class composition / multiple inheritance / polymorphism (?)
Post: RE: Subclasses and multiple dynamic inheritance / ...

(May-08-2021, 09:05 PM)Axel_Erfurt Wrote: Why QWidget with Layout, why not QMainWindow? class Text(QtWidgets.QMainWindow): def __init__(self): super(Text, self).__init__() self....
Alfalfa GUI 4 3,014 May-08-2021, 09:55 PM
  Question Thread: Need help with class composition / multiple inheritance / polymorphism (?)
Post: Need help with class composition / multiple inheri...

Trying to share a class (BodySuperClass), which can be either a QTextEdit or a QPlainTextEdit and contains Qt functions such as focusInEvent; #!/usr/bin/python3 from PyQt5 import QtWidgets class Te...
Alfalfa GUI 4 3,014 May-08-2021, 04:00 PM
  Star Thread: Recursively convert nested dicts to dict subclass
Post: Recursively convert nested dicts to dict subclass

Context: Elegant solution needed to monitor and save database changes during runtime. To minimze IO, the solution should be based on signals rather than polling and comparing against file content. So...
Alfalfa General Coding Help 1 2,840 Jan-22-2021, 04:34 AM
    Thread: Qt app won't crash after sys.excepthook override
Post: RE: Qt app won't crash after sys.excepthook overri...

(Dec-27-2020, 09:18 PM)deanhystad Wrote: I expect that Qt has an exception handler that catches the exception raised in the keypressEvent(). No such exception handler is ready to catch the exceptio...
Alfalfa GUI 3 2,615 Dec-28-2020, 01:16 AM
  Bug Thread: Qt app won't crash after sys.excepthook override
Post: Qt app won't crash after sys.excepthook override

As detailed in the docs, all exceptions can be caught by monkey patching sys.excepthook, while __excepthook__ contains the original value. However, when used in some Qt events, altough the error is ca...
Alfalfa GUI 3 2,615 Dec-27-2020, 08:16 PM
    Thread: Newbie trying to pass text from different thread
Post: RE: Newbie trying to pass text from different thre...

Not sure to understand what you are doing exactly, but here is a threading example in PyQt5. #!/usr/bin/python3 import time from PyQt5 import QtWidgets, QtCore class WorkerThread(QtCore.QObject): ...
Alfalfa GUI 1 2,571 Dec-18-2020, 01:12 AM
    Thread: CSS Styling for a QLabel inside a QListWidget
Post: RE: CSS Styling for a QLabel inside a QListWidget

For anyone interested, you can either 1. Set an id selector; obj.setObjectName("example")then in CSS; Quote:QLabel#example { color: red; } 2. Assign a CSS class to a QObject; obj.setProperty("class"...
Alfalfa GUI 2 5,053 Nov-30-2020, 02:59 AM
    Thread: CSS Styling for a QLabel inside a QListWidget
Post: RE: CSS Styling for a QLabel inside a QListWidget

The solution was to set the text in the QLabel widget instead of the QListWidgetItem, then to add 'QLabel after the ::item subcontrol of the CSS selector; #!/usr/bin/python3 from PyQt5 import QtWidg...
Alfalfa GUI 2 5,053 Nov-29-2020, 03:34 AM
  Question Thread: CSS Styling for a QLabel inside a QListWidget
Post: CSS Styling for a QLabel inside a QListWidget

Long story short, I use a QListWidget as a checklist. I would like to set a custom style for some items which are not checkable and rather act as text headers. I found this solution on Stack Overflow ...
Alfalfa GUI 2 5,053 Nov-28-2020, 11:55 PM
    Thread: File system representation in a data structure
Post: RE: File system representation in a data structure

I could get it to work by first copying the folder structure, then inserting each files in the proper nest. The result is a dict, which is then converted into a QMenu/QAction structure with a resursiv...
Alfalfa General Coding Help 1 2,030 Dec-18-2019, 01:56 AM
    Thread: File system representation in a data structure
Post: File system representation in a data structure

I have a problem related to a Qt app, but I figured it would be ok to post it in this section as is it not Qt specific. Still, I left the code in it's real context for the sake of the explanation. I n...
Alfalfa General Coding Help 1 2,030 Dec-17-2019, 01:51 AM
    Thread: How to subclass charts in openpyxl
Post: RE: How to subclass charts in openpyxl

After looking at the source code in openpyxl/chart/scatter_chart.py, I solved it by declaring __elements__ before __init__(): class Chart(openpyxl.chart.ScatterChart): __elements__ = ('scatterSty...
Alfalfa Data Science 2 2,544 Sep-24-2019, 12:17 AM
    Thread: How to subclass charts in openpyxl
Post: RE: How to subclass charts in openpyxl

After generating two spreadsheets, one good and one bad, the content of both has been extracted. The only file that differ is "/xl/charts/chart1.xml". Below is the content of both files: chart1.xml (...
Alfalfa Data Science 2 2,544 Sep-23-2019, 07:12 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020